X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e29f97a3c55598b9310a4643f9073b6b926672c..229d3f1c1fac88569a94b7a22fdc3149d57a46d4:/src/x11/utils.cpp?ds=inline diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 6c2f0ecf76..3ae95f5cc7 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -45,17 +45,10 @@ #pragma message disable nosimpint #endif -#ifdef __WXMOTIF__ -#include -#endif - -#ifdef __VMS__ -#pragma message enable nosimpint -#endif - #include "wx/unix/execute.h" #ifdef __WXMOTIF__ +#include #include "wx/motif/private.h" #endif @@ -63,9 +56,16 @@ #include "wx/x11/private.h" #endif +#if wxUSE_RESOURCES #include "X11/Xresource.h" +#endif + #include "X11/Xutil.h" +#ifdef __VMS__ +#pragma message enable nosimpint +#endif + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -165,9 +165,11 @@ static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid), XtRemoveInput(*id); } +#endif int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) { +#ifdef __WXMOTIF__ XtInputId id = XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(), fd, (XtPointer *) XtInputReadMask, @@ -175,8 +177,12 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) (XtPointer) proc_data); return (int)id; -} #endif +#ifdef __WXX11__ + // TODO + return 0; +#endif +} // ---------------------------------------------------------------------------- // misc @@ -203,6 +209,7 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn) *minorVsn = ProtocolRevision (display); return wxMOTIF_X; +#endif #ifdef __WXX11__ if (majorVsn) *majorVsn = 0; @@ -633,8 +640,9 @@ WXDisplay *wxGetDisplay() return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget()); else if (wxTheApp) return wxTheApp->GetInitialDisplay(); + return NULL; #endif -#ifdef __WXGTK__ +#ifdef __WXX11__ return wxApp::GetDisplay(); #endif } @@ -1054,6 +1062,29 @@ void wxAllocColor(Display *d,Colormap cmp,XColor *xc) } } +#ifdef __WXDEBUG__ +wxString wxGetXEventName(XEvent& event) +{ + int type = event.xany.type; + static char* event_name[] = { + "", "unknown(-)", // 0-1 + "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5 + "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9 + "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13 + "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16 + "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20 + "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23 + "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26 + "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29 + "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32 + "ClientMessage", "MappingNotify", // 33-34 + "unknown(+)"}; // 35 + type = wxMin(35, type); type = wxMax(1, type); + wxString str(event_name[type]); + return str; + } +#endif + #ifdef __WXMOTIF__ // ---------------------------------------------------------------------------- // accelerators @@ -1107,7 +1138,8 @@ char * wxFindAccelerator (const char *s) */ - wxBuffer[0] = '\0'; + static char buf[256]; + buf[0] = '\0'; char *tmp = copystring (s); s = tmp; char *p = tmp; @@ -1119,23 +1151,23 @@ char * wxFindAccelerator (const char *s) if (*p) { *p = '\0'; - if (wxBuffer[0]) - strcat (wxBuffer, " "); + if (buf[0]) + strcat (buf, " "); if (strcmp (s, "Alt")) - strcat (wxBuffer, s); + strcat (buf, s); else - strcat (wxBuffer, "Meta"); + strcat (buf, "Meta"); s = p++; } else { - strcat (wxBuffer, ""); - strcat (wxBuffer, s); + strcat (buf, ""); + strcat (buf, s); break; } } delete[]tmp; - return wxBuffer; + return buf; #endif } @@ -1199,3 +1231,11 @@ void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, boo #endif // __WXMOTIF__ + +bool wxWindowIsVisible(Window win) +{ + XWindowAttributes wa; + XGetWindowAttributes(wxGlobalDisplay(), win, &wa); + + return (wa.map_state == IsViewable); +}