X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FX11.cc;h=3344622429baf31c05776995a9a52e95057c0b37;hb=ce1cf6a710c67eb2ef06835fffdaed7c41c85b24;hp=2d146e6475d4eb561e7222ae1f421f791a3c61a6;hpb=c6069948906645d974f46bdb96617a9a6a504636;p=org.ibex.core.git diff --git a/src/org/xwt/plat/X11.cc b/src/org/xwt/plat/X11.cc index 2d146e6..3344622 100644 --- a/src/org/xwt/plat/X11.cc +++ b/src/org/xwt/plat/X11.cc @@ -274,7 +274,7 @@ void org::xwt::plat::X11$X11PixelBuffer::createStipple(org::xwt::plat::X11$X11Pi } void org::xwt::plat::X11$X11Surface::blit(org::xwt::PixelBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { - org::xwt::plat::X11$X11PixelBuffer *xdb = (org::xwt::plat::X11$X11DoubleBuffer*)db; + org::xwt::plat::X11$X11PixelBuffer *xdb = (org::xwt::plat::X11$X11PixelBuffer*)db; XCopyArea(display, *((Pixmap*)xdb->pm), *((Window*)window), *((GC*)gc), sx, sy, dx2 - dx, dy2 - dy, dx, dy); XFlush(display); } @@ -299,36 +299,6 @@ void org::xwt::plat::X11$X11PixelBuffer::fillRect (jint x, jint y, jint x2, jint XFillRectangle(display, (*((Pixmap*)pm)), (*((GC*)gc)), x, y, w, h); } -void org::xwt::plat::X11$X11PixelBuffer::drawString(::java::lang::String* font, ::java::lang::String* text, jint x, jint y, jint argb) { - - XRectangle rect; - rect.x = clipx, rect.y = clipy; rect.width = clipw; rect.height = cliph; - XSetClipMask(display, (*((GC*)clipped_gc)), None); - XSetClipRectangles(display, (*((GC*)clipped_gc)), 0, 0, &rect, 1, YSorted); - XSetForeground(display, (*((GC*)clipped_gc)), - ((((argb & 0x00FF0000) >> 16) * colormap_info->red_max) / 0xFF) * colormap_info->red_mult + - ((((argb & 0x0000FF00) >> 8) * colormap_info->green_max) / 0xFF) * colormap_info->green_mult + - ((((argb & 0x000000FF)) * colormap_info->blue_max) / 0xFF) * colormap_info->blue_mult + - colormap_info->base_pixel - ); - - // Grab the string - int len = min(1024, JvGetStringUTFLength(text)); - char buf[len + 1]; - JvGetStringUTFRegion(text, 0, len, buf); - buf[len] = '\0'; - - // Build the XTextItem structure - XTextItem textitem; - textitem.chars = buf; - textitem.nchars = len; - textitem.delta = 0; - textitem.font = ((XFontStruct*)org::xwt::plat::X11::fontToXFont(font))->fid; - - // Draw the text - XDrawText(display, (*((Pixmap*)pm)), (*((GC*)clipped_gc)), x, y, &textitem, 1); -} - // X11Surface ////////////////////////////////////////////////////////////////////// @@ -376,7 +346,7 @@ void org::xwt::plat::X11$X11Surface::setSize (jint width, jint height) { XFlush(display); } -void org::xwt::plat::X11$X11Surface::setLocation (jint x, jint y) { XMoveWindow(display, (*((Window*)window)), x, y); } +void org::xwt::plat::X11$X11Surface::setLocation () { XMoveWindow(display, (*((Window*)window)), root->x, root->y); } void org::xwt::plat::X11$X11Surface::toFront() { XRaiseWindow(display, (*((Window*)window))); } void org::xwt::plat::X11$X11Surface::toBack() { XLowerWindow(display, (*((Window*)window))); } @@ -791,34 +761,6 @@ void org::xwt::plat::X11::natInit() { org::xwt::util::Log::log(this->getClass(), JvNewStringLatin1(buf)); } -JArray* org::xwt::plat::X11::listNativeFonts() { - int numfonts; - char** xfonts = XListFonts(display, "-*-*-*-*-normal-*-*-*-*-*-*-*-*-*", 0xFFFFFFFF, &numfonts); - JArray* fonts = (JArray*)JvNewObjectArray(numfonts, &(::java::lang::String::class$), NULL); - java::lang::String** jfonts = (java::lang::String**)(elements(fonts)); - for(int i=0; imax_bounds.ascent; } -jint org::xwt::plat::X11::_getMaxDescent(::java::lang::String* font) { return ((XFontStruct*)fontToXFont(font))->max_bounds.descent; } -jint org::xwt::plat::X11::_stringWidth(::java::lang::String* font, ::java::lang::String* text) { - if (text == NULL) return 0; - int len = JvGetStringUTFLength(text); - char buf[len + 1]; - JvGetStringUTFRegion(text, 0, len, buf); - buf[len] = '\0'; - return XTextWidth((XFontStruct*)fontToXFont(font), buf, len); -} //////////////////////////////////////////////////////////////////////////////