]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/utils.cpp
Fixed usage of wxXmString
[wxWidgets.git] / src / x11 / utils.cpp
index 862f96e9cc19a81e8bc9b24e89d691e37ce578c4..3ae95f5cc7f2435af50c86c2ca2b0db95ad81a95 100644 (file)
 #pragma message disable nosimpint
 #endif
 
-#ifdef __WXMOTIF__
-#include <Xm/Xm.h>
-#endif
-
-#ifdef __VMS__
-#pragma message enable nosimpint
-#endif
-
 #include "wx/unix/execute.h"
 
 #ifdef __WXMOTIF__
+#include <Xm/Xm.h>
 #include "wx/motif/private.h"
 #endif
 
 #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
@@ -1056,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
@@ -1109,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;
@@ -1121,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, "<Key>");
-            strcat (wxBuffer, s);
+            strcat (buf, "<Key>");
+            strcat (buf, s);
             break;
         }
     }
     delete[]tmp;
-    return wxBuffer;
+    return buf;
 #endif
 }
 
@@ -1201,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);
+}