예제 #1
0
파일: wind.c 프로젝트: baruch/joes-sandbox
void Wind::localon()
  {
  int evt=0;
  int mask=0;
  XSetWindowAttributes attributes;
  XGCValues gcv;

  XGetGCValues(dsp,gtbknd(),GCForeground,&gcv);

  attributes.background_pixel=gcv.foreground;
  mask|=CWBackPixel;

  if(pixmap)
    {
    attributes.background_pixmap=pixmap;
    mask|=CWBackPixmap;
    }

  if(cursor)
    {
    attributes.cursor=cursor;
    mask|=CWCursor;
    }

  // FIXME!
/*
  if(x->funcs->expose || x->target && x->target->funcs->expose) evt|=ExposureMask;
  if(x->funcs->enternotify || x->target && x->target->funcs->enternotify) evt|=EnterWindowMask;
  if(x->funcs->leavenotify || x->target && x->target->funcs->leavenotify) evt|=LeaveWindowMask;
  if(x->funcs->buttonpress || x->target && x->target->funcs->buttonpress) evt|=ButtonPressMask;
  if(x->funcs->buttonrelease || x->target && x->target->funcs->buttonrelease) evt|=ButtonReleaseMask;
  if(x->funcs->motionnotify || x->target && x->target->funcs->motionnotify) evt|=ButtonMotionMask;
  if(x->funcs->keypress || x->target && x->target->funcs->keypress) evt|=KeyPressMask|KeyReleaseMask;
  if(x->funcs->configurenotify && gtmom(x)==gtmain(root)) evt|=StructureNotifyMask;
  if(x->funcs->focusin || x->funcs->focusout) evt|=FocusChangeMask;
*/

  evt|=ExposureMask;
  evt|=EnterWindowMask;
  evt|=LeaveWindowMask;
  evt|=ButtonReleaseMask;
  evt|=ButtonMotionMask;
  evt|=KeyPressMask;
  evt|=KeyReleaseMask;
  evt|=StructureNotifyMask;
  evt|=FocusChangeMask;
  evt|=ButtonPressMask;

  attributes.event_mask=evt;
  mask|=CWEventMask;

  if(override_flag)
    {
    attributes.override_redirect=1;
    }
  else attributes.override_redirect=0;
  mask|=CWOverrideRedirect;

  /* Create window */
  win=XCreateWindow(dsp,gtmom()->gtwin(),gtx(),gty(),gtwidth(),gtheight(),0,
                    CopyFromParent,InputOutput,CopyFromParent,
                    mask,&attributes);

  /* Duh, this should be the default */
  if(in==root->gtmain())
    hintinput(target,True);

  if(in==root->gtmain() && ckx() && cky())
    {
    hintposition(target,gtx(),gty());
    }

  if(target && target->hints)
    sendhints(win,target->hints);

  if(transient_flag)
    XSetTransientForHint(dsp,win,gtmom()->gtwin());

  /* Map and raise window */
  XMapRaised(dsp,win);

  if(XSaveContext(dsp,win,wins,(XPointer)this))
    {
    printf("Error\n");
    exit(1);
    }
  }
예제 #2
0
GlyphLayout::GlyphLayout(JNIEnv *env, jcharArray unicodes, jint offset, jint count,
            jint flags, jdoubleArray fontTX, jdoubleArray devTX, jboolean isAntiAliased,
            jboolean usesFractionalMetrics, fontObject *fo)
  : fNumGlyphs(0), fScriptCount(0), fScriptMax(eDefaultStorage), fRightToLeft(false), fDevTX(env, devTX)
{
    if (JNU_IsNull(env, unicodes) ) {
        JNU_ThrowIllegalArgumentException(env,"Unicode array is NULL!");
        return;
    }

    jint max = env->GetArrayLength(unicodes);

    if (offset + count > max) {
        JNU_ThrowArrayIndexOutOfBoundsException(env,
                                        "chars [offset + count]");
        return;
    }

    // !!! check to see how layout should adapt to devTX.  Should it ignore devTX
    // and then adjust the information by devTX afterwards?  Then it would perhaps
    // get incorrectly hinted advance information by the strike.  But if it uses
    // devTX then the advance and position information needs to be normalized
    // before returning it to native.

    TX gtx(fDevTX);
    TX ftx(env, fontTX);
    gtx.concat(ftx);
    FontTransform tx(gtx.m00, gtx.m10, gtx.m01, gtx.m11);

    jfloat x = (jfloat)gtx.m02;
    jfloat y = (jfloat)gtx.m12;

	const jchar *theChars = (const jchar *) env->GetPrimitiveArrayCritical(unicodes, NULL);

	if (theChars != NULL) {
	    const jchar *oldChars = theChars; // theChars can get changed, save original
        if (flags != 0) {
            if ((flags & 0x0001) != 0) {
                fRightToLeft = true;
            }

            if ((flags & 0x0002) != 0) {
                theChars += offset;
                max -= offset;
                offset = 0;
            }

            if ((flags & 0x0004) != 0) {
                max = offset + count;
            }
        }

        if (fo->GetFormat() == kCompositeFontFormat) {
            Strike *strike = &fo->getStrike(tx, isAntiAliased, usesFractionalMetrics);
            UInt32 *glyphs = new UInt32[count];
            ScriptRun scriptRun(theChars, offset, count);
            le_uint32 slot;

            charsToGlyphs(&theChars[offset], count, strike, glyphs);

            fScriptInfo = fScriptInfoBase;
            slot = glyphs[0] >> 24;

            while (scriptRun.next()) {
                le_int32 scriptStart = scriptRun.getScriptStart();
                le_int32 scriptEnd   = scriptRun.getScriptEnd();
                le_int32 scriptCode  = scriptRun.getScriptCode();

                le_int32 ch = scriptStart;
                while (ch < scriptEnd) {
                    while (ch < scriptEnd && slot == glyphs[ch - offset] >> 24) {
                        ch += 1;
                    }

                    if (fScriptCount >= fScriptMax) {
                        growScriptInfo();
                    }

                    fScriptInfo[fScriptCount].scriptStart = scriptStart;
                    fScriptInfo[fScriptCount].scriptCode  = scriptCode;
                    fScriptInfo[fScriptCount].scriptSlot  = slot;

                    fScriptCount += 1;

                    if (ch < scriptEnd) {
                        slot = glyphs[ch - offset] >> 24;
                        scriptStart = ch;
                    }
                }
            }

            delete[] glyphs;
            fScriptInfo[fScriptCount].scriptStart = scriptRun.getScriptEnd();
        } else {
예제 #3
0
파일: wind.c 프로젝트: baruch/joes-sandbox
void Wind::sty(int n)
  {
  if(y!=n && on_flag) XMoveWindow(dsp,gtwin(),gtx(),n);
  y=n;
  }