]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/utils.cpp
New positioning code, eliminating a lot of extra, unnecessary methods
[wxWidgets.git] / src / x11 / utils.cpp
index 9f6ed67e35324661f01c31c2ea15611c891a352c..d6b5b7df84cbdb8623b8ea6f94f95d273eec6320 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __VMS
-#define XtDisplay XTDISPLAY
-#endif
-
 #include "wx/setup.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #ifdef __VMS__
 #pragma message disable nosimpint
 #endif
-#include <Xm/Xm.h>
+
 #ifdef __VMS__
 #pragma message enable nosimpint
 #endif
 
 #include "wx/unix/execute.h"
 
-#include "wx/motif/private.h"
+#include "wx/x11/private.h"
+#include "X11/Xresource.h"
+#include "X11/Xutil.h"
 
 // ----------------------------------------------------------------------------
 // private functions
@@ -85,7 +83,11 @@ void wxFlushEvents()
     Display *display = (Display*) wxGetDisplay();
 
     XSync (display, FALSE);
+    XFlush(display);
 
+    // TODO
+#if 0
+    
     // XtAppPending returns availability of events AND timers/inputs, which
     // are processed via callbacks, so XtAppNextEvent will not return if
     // there are no events. So added '& XtIMXEvent' - Sergey.
@@ -95,12 +97,16 @@ void wxFlushEvents()
         // Jan Lessner: works better when events are non-X events
         XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent);
     }
+#endif
 }
 
 // Check whether this window wants to process messages, e.g. Stop button
 // in long calculations.
 bool wxCheckForInterrupt(wxWindow *wnd)
 {
+    wxASSERT_MSG(FALSE, "wxCheckForInterrupt not yet implemented.");
+    return FALSE;
+#if 0
     wxCHECK_MSG( wnd, FALSE, "NULL window in wxCheckForInterrupt" );
 
     Display *dpy=(Display*) wnd->GetXDisplay();
@@ -127,12 +133,13 @@ bool wxCheckForInterrupt(wxWindow *wnd)
     }
 
     return hadEvents;
+#endif
 }
 
 // ----------------------------------------------------------------------------
 // wxExecute stuff
 // ----------------------------------------------------------------------------
-
+#if 0
 static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid),
                                   XtInputId *id)
 {
@@ -156,6 +163,7 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
 
     return (int)id;
 }
+#endif
 
 // ----------------------------------------------------------------------------
 // misc
@@ -170,6 +178,7 @@ void wxBell()
 
 int wxGetOsVersion(int *majorVsn, int *minorVsn)
 {
+#if 0
     // FIXME TODO
     // This code is WRONG!! Does NOT return the
     // Motif version of the libs but the X protocol
@@ -181,6 +190,13 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
         *minorVsn = ProtocolRevision (display);
 
     return wxMOTIF_X;
+#else
+    if (majorVsn)
+        *majorVsn = 0;
+    if (minorVsn)
+        *minorVsn = 0;
+    return wxX11;
+#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -670,7 +686,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
 }
 
 
-// Configurable display in Motif
+// Configurable display in X11
 static WXDisplay *gs_currentDisplay = NULL;
 static wxString gs_displayName;
 
@@ -678,9 +694,6 @@ WXDisplay *wxGetDisplay()
 {
     if (gs_currentDisplay)
         return gs_currentDisplay;
-
-    if (wxTheApp && wxTheApp->GetTopLevelWidget())
-        return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
     else if (wxTheApp)
         return wxTheApp->GetInitialDisplay();
     else
@@ -691,7 +704,7 @@ bool wxSetDisplay(const wxString& display_name)
 {
     gs_displayName = display_name;
 
-    if ( !display_name )
+    if ( display_name.IsEmpty() )
     {
         gs_currentDisplay = NULL;
 
@@ -699,19 +712,7 @@ bool wxSetDisplay(const wxString& display_name)
     }
     else
     {
-        Cardinal argc = 0;
-
-        Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
-            (const char*) display_name,
-            (const char*) wxTheApp->GetAppName(),
-            (const char*) wxTheApp->GetClassName(),
-            NULL,
-#if XtSpecificationRelease < 5
-            0, &argc,
-#else
-            0, (int *)&argc,
-#endif
-            NULL);
+        Display* display = XOpenDisplay((const char*) display_name);
 
         if (display)
         {
@@ -817,24 +818,6 @@ char * wxFindAccelerator (const char *s)
 #endif
 }
 
-XmString wxFindAcceleratorText (const char *s)
-{
-    // VZ: this function returns incorrect keysym which completely breaks kbd
-    //     handling
-    return NULL;
-
-#if 0
-   // The accelerator text is after the \t char.
-    while (*s && *s != '\t')
-        s++;
-    if (*s == '\0')
-        return (NULL);
-    s++;
-    XmString text = XmStringCreateSimple ((char *)s);
-    return text;
-#endif
-}
-
 // ----------------------------------------------------------------------------
 // keycode translations
 // ----------------------------------------------------------------------------
@@ -1191,43 +1174,3 @@ void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
     }
 }
 
-
-// These functions duplicate those in wxWindow, but are needed
-// for use outside of wxWindow (e.g. wxMenu, wxMenuBar).
-
-// Change a widget's foreground and background colours.
-
-void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
-{
-    // When should we specify the foreground, if it's calculated
-    // by wxComputeColours?
-    // Solution: say we start with the default (computed) foreground colour.
-    // If we call SetForegroundColour explicitly for a control or window,
-    // then the foreground is changed.
-    // Therefore SetBackgroundColour computes the foreground colour, and
-    // SetForegroundColour changes the foreground colour. The ordering is
-    // important.
-
-    XtVaSetValues ((Widget) widget,
-        XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
-        NULL);
-}
-
-void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
-{
-    wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
-        (wxColour*) NULL);
-
-    XtVaSetValues ((Widget) widget,
-        XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
-        XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
-        XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
-        XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
-        NULL);
-
-    if (changeArmColour)
-        XtVaSetValues ((Widget) widget,
-        XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
-        NULL);
-}
-