Exemplo n.º 1
0
int
pulse_stream_set_volume(cubeb_stream * stm, float volume)
{
    uint32_t index;
    pa_operation * op;
    pa_volume_t vol;
    pa_cvolume cvol;
    const pa_sample_spec * ss;

    WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);

    while (!stm->context->default_sink_info) {
        WRAP(pa_threaded_mainloop_wait)(stm->context->mainloop);
    }

    /* if the pulse daemon is configured to use flat volumes,
     * apply our own gain instead of changing the input volume on the sink. */
    if (stm->context->default_sink_info->flags & PA_SINK_FLAT_VOLUME) {
        stm->volume = volume;
    } else {
        ss = WRAP(pa_stream_get_sample_spec)(stm->stream);

        vol = WRAP(pa_sw_volume_from_linear)(volume);
        WRAP(pa_cvolume_set)(&cvol, ss->channels, vol);

        index = WRAP(pa_stream_get_index)(stm->stream);

        op = WRAP(pa_context_set_sink_input_volume)(stm->context->context,
                index, &cvol, volume_success,
                stm);
        if (op) {
            operation_wait(stm->context, stm->stream, op);
            WRAP(pa_operation_unref)(op);
        }
    }

    WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);

    return CUBEB_OK;
}
Exemplo n.º 2
0
int
sigvec(int signo, struct sigvec *sv, struct sigvec *osv)
{
	int ret;
	struct sigvec nsv;

	if (sv) {
		nsv = *sv;
		nsv.sv_flags ^= SV_INTERRUPT;	/* !SA_INTERRUPT */
	}
	ret = WRAP(sigaction)(signo, sv ? (struct sigaction *)&nsv : NULL,
	    (struct sigaction *)osv);
	if (ret == 0 && osv)
		osv->sv_flags ^= SV_INTERRUPT;	/* !SA_INTERRUPT */
	return (ret);
}
Exemplo n.º 3
0
static void
glibHandleEvent (CompDisplay *d,
		 XEvent      *event)
{
    GLIB_DISPLAY (d);

    if (event->type == ClientMessage)
    {
	if (event->xclient.message_type == gd->notifyAtom)
	    glibWakeup (d);
    }

    UNWRAP (gd, d, handleEvent);
    (*d->handleEvent) (d, event);
    WRAP (gd, d, handleEvent, glibHandleEvent);
}
Exemplo n.º 4
0
/*
 * groupDonePaintScreen
 *
 */
void
groupDonePaintScreen (CompScreen *s)
{
	GroupSelection *group;

	GROUP_SCREEN (s);

	UNWRAP (gs, s, donePaintScreen);
	(*s->donePaintScreen)(s);
	WRAP (gs, s, donePaintScreen, groupDonePaintScreen);

	for (group = gs->groups; group; group = group->next)
	{
		if (group->tabbingState != NoTabbing)
			damageScreen (s);
		else if (group->changeState != NoTabChange)
			damageScreen (s);
		else if (group->tabBar)
		{
			Bool needDamage = FALSE;

			if ((group->tabBar->state == PaintFadeIn) ||
			    (group->tabBar->state == PaintFadeOut))
			{
				needDamage = TRUE;
			}

			if (group->tabBar->textLayer)
			{
				if ((group->tabBar->textLayer->state == PaintFadeIn) ||
				    (group->tabBar->textLayer->state == PaintFadeOut))
				{
					needDamage = TRUE;
				}
			}

			if (group->tabBar->bgAnimation)
				needDamage = TRUE;

			if (gs->draggedSlot)
				needDamage = TRUE;

			if (needDamage)
				groupDamageTabBarRegion (group);
		}
	}
}
static Bool
ringDamageWindowRect (CompWindow *w,
		      Bool	  initial,
		      BoxPtr     rect)
{
    Bool       status = FALSE;
    CompScreen *s = w->screen;

    RING_SCREEN (s);

    if (initial)
    {
	if (rs->grabIndex && isRingWin (w))
	{
	    ringAddWindowToList (s, w);
	    if (ringUpdateWindowList (s))
	    {
		RING_WINDOW (w);

		rw->adjust = TRUE;
		rs->moreAdjust = TRUE;
		rs->state = RingStateOut;
		damageScreen (s);
	    }
	}
    }
    else if (rs->state == RingStateSwitching)
    {
	RING_WINDOW (w);

	if (rw->slot)
	{
	    damageTransformedWindowRect (w,
					 rw->scale, rw->scale,
					 rw->tx, rw->ty,
					 rect);

	    status = TRUE;
	}
    }

    UNWRAP (rs, s, damageWindowRect);
    status |= (*s->damageWindowRect) (w, initial, rect);
    WRAP (rs, s, damageWindowRect, ringDamageWindowRect);

    return status;
}
Exemplo n.º 6
0
void render_bg(LPDIRECT3DDEVICE8 pd3dDevice, LPDIRECT3DTEXTURE8 bg)
{
    // Render the secondary color surface to the screen
    struct VERTEX { D3DXVECTOR4 p; FLOAT tu, tv; 
	};
    VERTEX v[4];
    v[0].p = D3DXVECTOR4(   0 - 0.5f,   0 - 0.5f, 0, 0 );  v[0].tu =   0; v[0].tv =   0;
    v[1].p = D3DXVECTOR4( 640 - 0.5f,   0 - 0.5f, 0, 0 );  v[1].tu = 640; v[1].tv =   0;
    v[2].p = D3DXVECTOR4( 640 - 0.5f, 480 - 0.5f, 0, 0 );  v[2].tu = 640; v[2].tv = 480;
    v[3].p = D3DXVECTOR4(   0 - 0.5f, 480 - 0.5f, 0, 0 );  v[3].tu =   0; v[3].tv = 480;
	pd3dDevice->SetVertexShader( D3DFVF_XYZRHW|D3DFVF_TEX1);

    pd3dDevice->SetTexture( 0, bg);
	pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0);

	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);

	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU,  D3DTADDRESS_CLAMP );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV,  D3DTADDRESS_CLAMP );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER , D3DTEXF_LINEAR);
	pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER , D3DTEXF_LINEAR);

	pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xff202020);

	pd3dDevice->SetRenderState( D3DRS_ZENABLE,   FALSE );
    pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
	pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
/*
	int i=0;

//	for(int i=32;i>0;i=i-3)
	{
    v[0].tu =   0+i; v[0].tv =   0+i;
    v[1].tu = 640-i; v[1].tv =   0+i;
    v[2].tu = 640-i; v[2].tv = 480-i;
    v[3].tu =   0+i; v[3].tv = 480-i;
*/
    WRAP(pd3dDevice->DrawPrimitiveUP( D3DPT_QUADLIST, 1, v, 6*sizeof(FLOAT) ));

	pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, -1);

    pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE);
}
Exemplo n.º 7
0
void SolveSpaceUI::PopOntoCurrentFrom(UndoStack *uk) {
    int i;

    ssassert(uk->cnt > 0, "Cannot pop from empty undo stack");
    (uk->cnt)--;
    uk->write = WRAP(uk->write - 1, MAX_UNDO);

    UndoState *ut = &(uk->d[uk->write]);

    // Free everything in the main copy of the program before replacing it
    for(i = 0; i < SK.groupOrder.n; i++) {
        Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
        g->Clear();
    }
    SK.group.Clear();
    SK.groupOrder.Clear();
    SK.request.Clear();
    SK.constraint.Clear();
    SK.param.Clear();
    SK.style.Clear();

    // And then do a shallow copy of the state from the undo list
    ut->group.MoveSelfInto(&(SK.group));
    for(i = 0; i < ut->groupOrder.n; i++)
        SK.groupOrder.Add(&ut->groupOrder.elem[i]);
    ut->request.MoveSelfInto(&(SK.request));
    ut->constraint.MoveSelfInto(&(SK.constraint));
    ut->param.MoveSelfInto(&(SK.param));
    ut->style.MoveSelfInto(&(SK.style));
    SS.GW.activeGroup = ut->activeGroup;

    // No need to free it, since a shallow copy was made above
    *ut = {};

    // And reset the state everywhere else in the program, since the
    // sketch just changed a lot.
    SS.GW.ClearSuper();
    SS.TW.ClearSuper();
    SS.ReloadAllImported();
    SS.GenerateAll(SolveSpaceUI::Generate::ALL);
    SS.ScheduleShowTW();

    // Activate the group that was active before.
    Group *activeGroup = SK.GetGroup(SS.GW.activeGroup);
    activeGroup->Activate();
}
Exemplo n.º 8
0
static void
thumbWindowResizeNotify (CompWindow *w,
                         int dx,
                         int dy,
                         int dwidth,
                         int dheight)
{
	CompScreen *s = w->screen;

	THUMB_SCREEN (s);

	thumbUpdateThumbnail (s);

	UNWRAP (ts, s, windowResizeNotify);
	(*s->windowResizeNotify)(w, dx, dy, dwidth, dheight);
	WRAP (ts, s, windowResizeNotify, thumbWindowResizeNotify);
}
Exemplo n.º 9
0
JNIEXPORT jobject JNICALL Java_au_notzed_jjmpeg_AVIOContextNative_open
(JNIEnv *env, jclass jc, jstring jurl, int flags, jobject jerror_buf) {
	const char *url = STR(jurl);
	AVIOContext *context = NULL;
	int *resp = ADDR(jerror_buf);
	jobject res = NULL;

	resp[0] = CALLDL(avio_open)(&context, url, flags);

	if (resp[0] == 0) {
		res = WRAP(context, sizeof(*context));
	}

	RSTR(jurl, url);

	return res;
}
Exemplo n.º 10
0
static int AVIOContext_writePacket(void *opaque, uint8_t *buf, int buf_size) {
	struct avio_data *bd = opaque;
	JNIEnv *env;

	d(printf("iocontext.writePacket()\n"));

	if (bd == NULL)
		return -1;

	if ((*vm)->AttachCurrentThread(vm, (void**) &env, NULL) != 0)
		return -1;

	jobject byteBuffer = WRAP(buf, buf_size);
	int res = (*env)->CallIntMethod(env, bd->jo, byteio_writePacket, byteBuffer);

	return res;
}
Exemplo n.º 11
0
void NetworkPlugin::handleFTFinish(const std::string &user, const std::string &buddyName, const std::string fileName, unsigned long size, unsigned long ftid) {
	pbnetwork::File room;
	room.set_username(user);
	room.set_buddyname(buddyName);
	room.set_filename(fileName);
	room.set_size(size);
	if (ftid) {
		room.set_ftid(ftid);
	}

	std::string message;
	room.SerializeToString(&message);

	WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_FT_FINISH);
 
	send(message);
}
Exemplo n.º 12
0
static Bool
minFocusWindow (CompWindow *w)
{
	Bool status;

	MIN_SCREEN (w->screen);
	MIN_WINDOW (w);

	if (mw->unmapCnt)
		return FALSE;

	UNWRAP (ms, w->screen, focusWindow);
	status = (*w->screen->focusWindow) (w);
	WRAP (ms, w->screen, focusWindow, minFocusWindow);

	return status;
}
Exemplo n.º 13
0
static void
scalefilterHandleEcompEvent (CompDisplay *d,
	 		      char        *pluginName,
	 		      char        *eventName,
	 		      CompOption  *option,
	 		      int         nOption)
{
    FILTER_DISPLAY (d);

    UNWRAP (fd, d, handleEcompEvent);
    (*d->handleEcompEvent) (d, pluginName, eventName, option, nOption);
    WRAP (fd, d, handleEcompEvent, scalefilterHandleEcompEvent);

    if ((strcmp (pluginName, "scale") == 0) &&
	(strcmp (eventName, "activate") == 0))
    {
	Window xid = getIntOptionNamed (option, nOption, "root", 0);
	Bool activated = getBoolOptionNamed (option, nOption, "active", FALSE);
	CompScreen *s = findScreenAtDisplay (d, xid);

	if (s)
	{
	    FILTER_SCREEN (s);
	    SCALE_SCREEN (s);

	    if (activated)
	    {
		matchFini (&fs->scaleMatch);
		matchInit (&fs->scaleMatch);
		matchCopy (&fs->scaleMatch, ss->currentMatch);
		matchUpdate (d, &fs->scaleMatch);
		fs->matchApplied = FALSE;
	    }

	    if (!activated)
	    {
		if (fs->filterInfo)
		{
		    ss->currentMatch = fs->filterInfo->origMatch;
		    scalefilterFiniFilterInfo (s, TRUE);
		}
		fs->matchApplied = FALSE;
	    }
	}
    }
}
Exemplo n.º 14
0
Arquivo: svg.c Projeto: zmike/compiz
static void
svgWindowResizeNotify(CompWindow *w,
                      int dx,
                      int dy,
                      int dwidth,
                      int dheight)
{
    SVG_SCREEN(w->screen);
    SVG_WINDOW(w);

    if (sw->source)
        updateWindowSvgContext(w, sw->source);

    UNWRAP(ss, w->screen, windowResizeNotify);
    (*w->screen->windowResizeNotify)(w, dx, dy, dwidth, dheight);
    WRAP(ss, w->screen, windowResizeNotify, svgWindowResizeNotify);
}
static void
scaleaddonSelectWindow (CompWindow *w)
{
    CompScreen *s = w->screen;

    ADDON_DISPLAY (s->display);
    ADDON_SCREEN (s);
    SCALE_SCREEN (s);

    ad->highlightedWindow     = w->id;

    scaleaddonCheckWindowHighlight (s);

    UNWRAP (as, ss, selectWindow);
    (*ss->selectWindow) (w);
    WRAP (as, ss, selectWindow, scaleaddonSelectWindow);
}
Exemplo n.º 16
0
Arquivo: video.c Projeto: zmike/compiz
static void
videoWindowResizeNotify(CompWindow *w,
                        int dx,
                        int dy,
                        int dwidth,
                        int dheight)
{
   VIDEO_SCREEN(w->screen);
   VIDEO_WINDOW(w);

   if (vw->source)
     updateWindowVideoContext(w, vw->source);

   UNWRAP(vs, w->screen, windowResizeNotify);
   (*w->screen->windowResizeNotify)(w, dx, dy, dwidth, dheight);
   WRAP(vs, w->screen, windowResizeNotify, videoWindowResizeNotify);
}
Exemplo n.º 17
0
static void add_token_to_array(word_t *token)
{
    word_t *w = w_token_array[WRAP(tok_count)];

    w->leng = token->leng;
    memcpy(w->u.text, token->u.text, w->leng);
    Z(w->u.text[w->leng]);	/* for easier debugging - removable */

    if (DEBUG_MULTI(1))
	fprintf(stderr, "%s:%d  %2s  %2d %2d %p %s\n", __FILE__, __LINE__,
		"", tok_count, w->leng, w->u.text, w->u.text);

    tok_count += 1;
    init_token = 1;

    return;
}
Exemplo n.º 18
0
void NetworkPlugin::handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags, pbnetwork::StatusType status, const std::string &statusMessage, const std::string &newname) {
	pbnetwork::Participant d;
	d.set_username(user);
	d.set_nickname(nickname);
	d.set_room(room);
	d.set_flag(flags);
	d.set_newname(newname);
	d.set_status((pbnetwork::StatusType) status);
	d.set_statusmessage(statusMessage);

	std::string message;
	d.SerializeToString(&message);

	WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_PARTICIPANT_CHANGED);

	send(message);
}
Exemplo n.º 19
0
Arquivo: fade.c Projeto: zmike/compiz
static Bool
fadeFocusWindow(CompWindow *w)
{
   Bool status;

   FADE_SCREEN(w->screen);
   FADE_WINDOW(w);

   if (fw->destroyCnt || fw->unmapCnt)
     return FALSE;

   UNWRAP(fs, w->screen, focusWindow);
   status = (*w->screen->focusWindow)(w);
   WRAP(fs, w->screen, focusWindow, fadeFocusWindow);

   return status;
}
Exemplo n.º 20
0
void receive_poll(PtTimestamp ts, void *userData)
{
  int count, command;
  unsigned int latest;
  PmEvent event;
  
  if (inStream==NULL)
    return;
  
  if (Pm_Poll(inStream)!=TRUE)
    return;
  
  while ((count = Pm_Read(inStream, &event, 1))) {
    if (count == 1) {
      
      /* there seems to be a constant stream of MIDI events, not all of which are interesting */
      /* the status has the command in the highest 4 bits and the channel in the lowest 4 bits */
      command = Pm_MessageStatus(event.message) & MIDI_CODE_MASK;
      if ((command == MIDI_ON_NOTE)         ||
              (command == MIDI_OFF_NOTE )   ||
              (command == MIDI_CH_PROGRAM ) ||
              (command == MIDI_CTRL)        ||
              (command == MIDI_POLY_TOUCH ) ||
              (command == MIDI_TOUCH )      ||
              (command == MIDI_BEND )) {
        
        /* store the latest event at the end of the ring buffer */
        latest = WRAP(numReceived, INPUT_BUFFER_SIZE);
        numReceived++;
        
        channel   [latest] = (double)(Pm_MessageStatus(event.message) & MIDI_CHN_MASK);
        note      [latest] = (double)Pm_MessageData1(event.message);
        velocity  [latest] = (double)Pm_MessageData2(event.message);
        timestamp [latest] = (double)event.timestamp;
        
        if (verbose) {
          mexPrintf("channel = %2d, note = %3d, velocity = %3d, timestamp = %g\n", (int)channel[latest], (int)note[latest], (int)velocity[latest], timestamp[latest]);
          mexEvalString("try, drawnow limitrate nocallbacks; end");
        }
      }
    }
    else
      mexWarnMsgTxt(Pm_GetErrorText(count));
  }
}
Exemplo n.º 21
0
static int
sessionInitDisplay (CompPlugin  *p,
		    CompDisplay *d)
{
    SessionDisplay *sd;
    char           *prevClientId;

    sd = malloc (sizeof (SessionDisplay));
    if (!sd)
	return FALSE;

    if (!compInitDisplayOptionsFromMetadata (d,
					     &sessionMetadata,
					     sessionDisplayOptionInfo,
					     sd->opt,
					     SESSION_DISPLAY_OPTION_NUM))
    {
	compFiniDisplayOptions (d, sd->opt, SESSION_DISPLAY_OPTION_NUM);
	free (sd);
	return FALSE;
    }

    d->base.privates[displayPrivateIndex].ptr = sd;

    sd->visibleNameAtom = XInternAtom (d->display, "_NET_WM_VISIBLE_NAME", 0);
    sd->clientIdAtom = XInternAtom (d->display, "SM_CLIENT_ID", 0);
    sd->embedInfoAtom = XInternAtom (d->display, "_XEMBED_INFO", 0);
    sd->roleAtom = XInternAtom (d->display, "WM_WINDOW_ROLE", 0);
    sd->commandAtom = XInternAtom (d->display, "WM_COMMAND", 0);

    prevClientId = getSessionClientId (CompSessionPrevClientId);
    if (prevClientId)
    {
	loadState (d, prevClientId);
	free (prevClientId);
    }

    sd->windowAddTimeout = compAddTimeout (0, 0, sessionWindowAddTimeout, d);

    WRAP (sd, d, handleEvent, sessionHandleEvent);

    d->base.privates[displayPrivateIndex].ptr = sd;

    return TRUE;
}
Exemplo n.º 22
0
static void
pulse_context_destroy(cubeb * ctx)
{
  pa_operation * o;

  WRAP(pa_threaded_mainloop_lock)(ctx->mainloop);
  o = WRAP(pa_context_drain)(ctx->context, context_notify_callback, ctx);
  if (o) {
    operation_wait(ctx, NULL, o);
    WRAP(pa_operation_unref)(o);
  }
  WRAP(pa_context_set_state_callback)(ctx->context, NULL, NULL);
  WRAP(pa_context_disconnect)(ctx->context);
  WRAP(pa_context_unref)(ctx->context);
  WRAP(pa_threaded_mainloop_unlock)(ctx->mainloop);
}
static Bool
staticDamageWindowRect (CompWindow *w,
                        Bool       initial,
                        BoxPtr     rect)
{
    CompScreen *s = w->screen;
    Bool status;

    STATIC_SCREEN (s);

    UNWRAP (ss, s, damageWindowRect);
    status = (*s->damageWindowRect) (w, initial, rect);
    WRAP (ss, s, damageWindowRect, staticDamageWindowRect);

    damageScreen (s);

    return status;
}
Exemplo n.º 24
0
void NetworkPlugin::sendConfig(const PluginConfig &cfg) {
	std::string data = "[registration]";
	data += std::string("needPassword="******"1" : "0") + "\n";

	for (std::vector<std::string>::const_iterator it = cfg.m_extraFields.begin(); it != cfg.m_extraFields.end(); it++) {
		data += std::string("extraField=") + (*it) + "\n";
	}

	pbnetwork::BackendConfig m;
	m.set_config(data);

	std::string message;
	m.SerializeToString(&message);

	WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_BACKEND_CONFIG);

	send(message);
}
Exemplo n.º 25
0
Arquivo: video.c Projeto: zmike/compiz
static Bool
videoDamageWindowRect(CompWindow *w,
                      Bool initial,
                      BoxPtr rect)
{
   Bool status;

   VIDEO_SCREEN(w->screen);

   if (initial)
     videoWindowUpdate(w);

   UNWRAP(vs, w->screen, damageWindowRect);
   status = (*w->screen->damageWindowRect)(w, initial, rect);
   WRAP(vs, w->screen, damageWindowRect, videoDamageWindowRect);

   return status;
}
Exemplo n.º 26
0
static Bool
decorDamageWindowRect (CompWindow *w,
		       Bool	  initial,
		       BoxPtr     rect)
{
    Bool status;

    DECOR_SCREEN (w->screen);

    if (initial)
	decorWindowUpdate (w, TRUE);

    UNWRAP (ds, w->screen, damageWindowRect);
    status = (*w->screen->damageWindowRect) (w, initial, rect);
    WRAP (ds, w->screen, damageWindowRect, decorDamageWindowRect);

    return status;
}
static void
tilePaintScreen (CompScreen   *s,
		 CompOutput   *outputs,
		 int          numOutputs,
		 unsigned int mask)
{
    TILE_SCREEN (s);

    if (ts->grabIndex)
    {
	outputs = &s->fullscreenOutput;
	numOutputs = 1;
    }

    UNWRAP (ts, s, paintScreen);
    (*s->paintScreen) (s, outputs, numOutputs, mask);
    WRAP (ts, s, paintScreen, tilePaintScreen);
}
Exemplo n.º 28
0
static int
create_pa_stream(cubeb_stream * stm,
                 pa_stream ** pa_stm,
                 cubeb_stream_params * stream_params,
                 char const * stream_name)
{
  assert(stm && stream_params);
  *pa_stm = NULL;
  pa_sample_spec ss;
  ss.format = cubeb_to_pulse_format(stream_params->format);
  if (ss.format == PA_SAMPLE_INVALID)
    return CUBEB_ERROR_INVALID_FORMAT;
  ss.rate = stream_params->rate;
  ss.channels = stream_params->channels;

  *pa_stm = WRAP(pa_stream_new)(stm->context->context, stream_name, &ss, NULL);
  return (*pa_stm == NULL) ? CUBEB_ERROR : CUBEB_OK;
}
Exemplo n.º 29
0
static Bool
colorFilterInitDisplay (CompPlugin  *p,
                        CompDisplay *d)
{
	ColorFilterDisplay *cfd;

	cfd = malloc (sizeof (ColorFilterDisplay));
	if (!cfd)
		return FALSE;

	cfd->screenPrivateIndex = allocateScreenPrivateIndex ();
	if (cfd->screenPrivateIndex < 0)
	{
		free (cfd);
		return FALSE;
	}

	WRAP (cfd, d, handleEvent, colorFilterHandleEvent);

	const BananaValue *
	option_toggle_window_key = bananaGetOption (bananaIndex,
	                                            "toggle_window_key",
	                                            -1);

	registerKey (option_toggle_window_key->s, &cfd->toggle_window_key);

	const BananaValue *
	option_toggle_screen_key = bananaGetOption (bananaIndex,
	                                            "toggle_screen_key",
	                                            -1);

	registerKey (option_toggle_screen_key->s, &cfd->toggle_screen_key);

	const BananaValue *
	option_switch_filter_key = bananaGetOption (bananaIndex,
	                                            "switch_filter_key",
	                                            -1);

	registerKey (option_switch_filter_key->s, &cfd->switch_filter_key);

	d->privates[displayPrivateIndex].ptr = cfd;

	return TRUE;
}
static void
magPaintScreen (CompScreen   *s,
		CompOutput   *outputs,
		int          numOutput,
		unsigned int mask)
{
    XRectangle     r;

    MAG_SCREEN (s);

    UNWRAP (ms, s, paintScreen);
    (*s->paintScreen) (s, outputs, numOutput, mask);
    WRAP (ms, s, paintScreen, magPaintScreen);

    if (ms->zoom == 1.0)
	return; 

    r.x      = 0;
    r.y      = 0;
    r.width  = s->width;
    r.height = s->height;

    if (s->lastViewport.x      != r.x     ||
	s->lastViewport.y      != r.y     ||
	s->lastViewport.width  != r.width ||
	s->lastViewport.height != r.height)
    {
	glViewport (r.x, r.y, r.width, r.height);
	s->lastViewport = r;
    }

    switch (ms->mode)
    {
    case ModeImageOverlay:
	magPaintImage (s);
	break;
    case ModeFisheye:
	magPaintFisheye (s);
	break;
    default:
	magPaintSimple (s);
    }

}