X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FX11.cc;h=3d64218b3651b6381c652cb05debf57086a1d222;hb=6eaf54fa906754ce35a7db0e8207fc6bbde5464d;hp=53e20dee7aaf4b134b2178e21bdca3dc8d82a2c3;hpb=a6c4f7b784acf2269c33188982b0d479cc11a0f4;p=org.ibex.core.git diff --git a/src/org/ibex/plat/X11.cc b/src/org/ibex/plat/X11.cc index 53e20de..3d64218 100644 --- a/src/org/ibex/plat/X11.cc +++ b/src/org/ibex/plat/X11.cc @@ -1,7 +1,6 @@ -// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] -// see below for copyright information on the second portion of this file - -#include "POSIX.cc" +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the GNU General Public License version 2 ("the License"). +// You may not use this file except in compliance with the License. #include #include @@ -13,15 +12,15 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -29,6 +28,8 @@ #include #include +#include "POSIX.cc" + // static (per-xserver) data static Visual* visual; static Colormap s_colormap; @@ -66,7 +67,7 @@ static void ensureShmSize(int size) { } } -void org::ibex::plat::X11$X11PixelBuffer::fastDrawPicture(org::ibex::Picture* s, +void org::ibex::plat::X11$X11PixelBuffer::fastDrawPicture(org::ibex::graphics::Picture* s, jint dx, jint dy, jint cx1, jint cy1, jint cx2, jint cy2) { org::ibex::plat::X11$X11Picture* source = (org::ibex::plat::X11$X11Picture*)s; @@ -82,7 +83,7 @@ void org::ibex::plat::X11$X11PixelBuffer::fastDrawPicture(org::ibex::Picture* s, cx1 - dx, cy1 - dy, cx2 - cx1, cy2 - cy1, cx1, cy1); } -void org::ibex::plat::X11$X11PixelBuffer::slowDrawPicture(org::ibex::Picture* s, +void org::ibex::plat::X11$X11PixelBuffer::slowDrawPicture(org::ibex::graphics::Picture* s, jint dx, jint dy, jint cx1, jint cy1, jint cx2, jint cy2, jint rgb, jboolean alphaOnly) { @@ -138,7 +139,7 @@ void org::ibex::plat::X11$X11PixelBuffer::slowDrawPicture(org::ibex::Picture* s, (((int)*(current_pixel + 1)) << 8) | (((int)*(current_pixel + 2))); break; case 32: targetpixel = *((int*)current_pixel); break; - default: org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: bpp not a multiple of 8!")); + default: org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: bpp not a multiple of 8!")); } targetpixel -= colormap_info->base_pixel; @@ -173,7 +174,7 @@ void org::ibex::plat::X11$X11PixelBuffer::slowDrawPicture(org::ibex::Picture* s, break; } case 32: *((uint32_t*)current_pixel) = destpixel; break; - default: org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: bpp not a multiple of 8!")); + default: org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: bpp not a multiple of 8!")); } } } @@ -275,7 +276,7 @@ void org::ibex::plat::X11$X11PixelBuffer::createStipple(org::ibex::plat::X11$X11 XPutImage(display, (*((Pixmap*)stipple)), stipple_gc, &xi, 0, 0, 0, 0, width, height); } -void org::ibex::plat::X11$X11Surface::blit(org::ibex::PixelBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { +void org::ibex::plat::X11$X11Surface::blit(org::ibex::graphics::PixelBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { org::ibex::plat::X11$X11PixelBuffer *xdb = (org::ibex::plat::X11$X11PixelBuffer*)db; XCopyArea(display, *((Pixmap*)xdb->pm), *((Window*)window), *((GC*)gc), sx, sy, dx2 - dx, dy2 - dy, dx, dy); XFlush(display); @@ -304,7 +305,7 @@ void org::ibex::plat::X11$X11PixelBuffer::fillRect (jint x, jint y, jint x2, jin // X11Surface ////////////////////////////////////////////////////////////////////// -void org::ibex::plat::X11$X11Surface::setIcon(org::ibex::Picture* pic) { +void org::ibex::plat::X11$X11Surface::setIcon(org::ibex::graphics::Picture* pic) { org::ibex::plat::X11$X11Picture* p = ((org::ibex::plat::X11$X11Picture*)pic); org::ibex::plat::X11$X11PixelBuffer* old_dbuf = p->doublebuf; p->buildPixelBuffer(1); @@ -676,14 +677,14 @@ int errorHandler(Display* d, XErrorEvent* e) { void org::ibex::plat::X11::natInit() { if (!XInitThreads()) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("Your X11 libraries do not support multithreaded programs")); + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("Your X11 libraries do not support multithreaded programs")); char* DISPLAY = getenv("DISPLAY"); if (DISPLAY == NULL || strlen(DISPLAY) == 0) DISPLAY = ":0.0"; display = XOpenDisplay(DISPLAY); if (display == 0) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("Unable to connect to X11 display server")); + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("Unable to connect to X11 display server")); screen_num = XDefaultScreen(display); colorDepth = (jint)(DefaultDepth(((Display*)display), 0)); @@ -746,16 +747,15 @@ void org::ibex::plat::X11::natInit() { // FIXME: don't know why (True, False) is the best solution... if(XmuLookupStandardColormap(display, screen_num, visual->visualid, colorDepth, XA_RGB_BEST_MAP, True, False) == 0) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: XmuLookupStandardColormap failed")); - + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: XmuLookupStandardColormap failed")); XStandardColormap* best_map_info = NULL; int count; if (XGetRGBColormaps(display, RootWindow(display, screen_num), &best_map_info, &count, XA_RGB_BEST_MAP) == 0) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: couldn't allocate a standard colormap")); + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: couldn't allocate a standard colormap")); if (!best_map_info->colormap) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: XmuLookupStandardColomap succeded, but no colormap was found on the root window")); + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: XmuLookupStandardColomap succeded, but no colormap was found on the root window")); if (best_map_info->red_max == 0) - org::ibex::Platform::criticalAbort(JvNewStringLatin1("ERROR: standard colormap exists, but was improperly allocated")); + org::ibex::plat::Platform::criticalAbort(JvNewStringLatin1("ERROR: standard colormap exists, but was improperly allocated")); s_colormap = best_map_info->colormap; colormap_info = best_map_info; @@ -769,9 +769,8 @@ void org::ibex::plat::X11::natInit() { org::ibex::util::Log::info(this->getClass(), JvNewStringLatin1(buf)); } -//#include "WINGs/WINGs.h" +#include "WINGs/WINGs.h" jstring org::ibex::plat::X11::_fileDialog(jstring suggestedFileName, jboolean write) { -#ifdef asfasdfasf int argc = 1; char* argv[2]; argv[0] = "Ibex"; @@ -794,11 +793,9 @@ jstring org::ibex::plat::X11::_fileDialog(jstring suggestedFileName, jboolean wr if (WMRunModalFilePanelForDirectory(oPanel, NULL, buf, /*title*/ NULL, NULL) != True) return NULL; return JvNewStringLatin1(WMGetFilePanelFileName(oPanel)); } -#endif return NULL; } - ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -2334,3 +2331,4 @@ XmuDeleteStandardColormap(Display *dpy, int screen, Atom property) } } +