X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FX11.cc;h=0e91eceeb894c5f0d1e7a1c81b6ac7fd63a8e180;hb=d892b1ff73b696e37812afd7d78c2eaae3342a0b;hp=81e61fbf26d5746452b1ee9de030ec525504fb6c;hpb=3591b88b94a6bb378af3d4abe6eb5233ce583104;p=org.ibex.core.git diff --git a/src/org/ibex/plat/X11.cc b/src/org/ibex/plat/X11.cc index 81e61fb..0e91ece 100644 --- a/src/org/ibex/plat/X11.cc +++ b/src/org/ibex/plat/X11.cc @@ -1,8 +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" - #include #include #include @@ -29,6 +27,8 @@ #include #include +#include "POSIX.cc" + // static (per-xserver) data static Visual* visual; static Colormap s_colormap; @@ -397,7 +397,7 @@ void org::ibex::plat::X11$X11Surface::natInit() { XTextProperty tp; tp.value = (unsigned char*)"Ibex"; - tp.nitems = 3; + tp.nitems = 4; tp.encoding = XA_STRING; tp.format = 8; XSetTextProperty(display, (*((Window*)window)), &tp, XA_WM_CLASS); @@ -526,6 +526,12 @@ void org::ibex::plat::X11$X11Surface::dispatchEvent(gnu::gcj::RawData* ev) { } else if (e->type == ButtonPress) { XButtonEvent* xbe = (XButtonEvent*)(e); + switch(xbe->button) { + case 4: VScroll((jfloat)-1.0); return; + case 5: VScroll((jfloat)1.0); return; + case 6: HScroll((jfloat)-1.0); return; + case 7: HScroll((jfloat)1.0); return; + } if (xbe->button == 2) xbe->button = 3; else if (xbe->button == 3) xbe->button = 2; Press(xbe->button); @@ -741,7 +747,6 @@ 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")); - XStandardColormap* best_map_info = NULL; int count; if (XGetRGBColormaps(display, RootWindow(display, screen_num), &best_map_info, &count, XA_RGB_BEST_MAP) == 0) @@ -763,7 +768,32 @@ void org::ibex::plat::X11::natInit() { org::ibex::util::Log::info(this->getClass(), JvNewStringLatin1(buf)); } - +#include "WINGs/WINGs.h" +jstring org::ibex::plat::X11::_fileDialog(jstring suggestedFileName, jboolean write) { + int argc = 1; + char* argv[2]; + argv[0] = "Ibex"; + argv[1] = NULL; + // FIXME see WINGs/Tests/filedialog.c for more info... need an icon + WMInitializeApplication("Ibex", &argc, argv); + WMScreen *scr = WMCreateSimpleApplicationScreen(display); + int len = min(1024, JvGetStringUTFLength(suggestedFileName)); + char buf[len + 1]; + JvGetStringUTFRegion(suggestedFileName, 0, len, buf); + buf[len] = '\0'; + if (write) { + WMSavePanel *sPanel; + sPanel = WMGetSavePanel(scr); + if (WMRunModalFilePanelForDirectory(sPanel, NULL, buf, /*title*/ NULL, NULL) != True) return NULL; + return JvNewStringLatin1(WMGetFilePanelFileName(sPanel)); + } else { + WMOpenPanel *oPanel; + oPanel = WMGetOpenPanel(scr); + if (WMRunModalFilePanelForDirectory(oPanel, NULL, buf, /*title*/ NULL, NULL) != True) return NULL; + return JvNewStringLatin1(WMGetFilePanelFileName(oPanel)); + } + return NULL; +} ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -2300,3 +2330,4 @@ XmuDeleteStandardColormap(Display *dpy, int screen, Atom property) } } +