]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/window.cpp
implemented Freeze/Thaw() (patch 922156)
[wxWidgets.git] / src / motif / window.cpp
index 6b87a729e162e5cdc41294fffd0cd392825e6994..a50692831c0390bf2c78549352f5dbd16eb85250 100644 (file)
@@ -200,9 +200,6 @@ bool wxWindow::MapOrUnmap(WXWidget widget, bool domap)
 
 void wxWindow::Init()
 {
-    // generic initializations first
-    InitBase();
-
     // Motif-specific
     m_needsRefresh = TRUE;
     m_mainWidget = (WXWidget) 0;
@@ -210,7 +207,6 @@ void wxWindow::Init()
     m_winCaptured = FALSE;
 
     m_isShown = TRUE;
-    m_isBeingDeleted = FALSE;
     
     m_hScrollBar =
     m_vScrollBar =
@@ -374,9 +370,6 @@ wxWindow::~wxWindow()
         DetachWidget(wMain);
     }
 
-    if ( m_parent )
-        m_parent->RemoveChild( this );
-
     // If m_drawingArea, we're a fully-fledged window with drawing area,
     // scrollbars etc. (what wxCanvas used to be)
     if ( m_drawingArea )
@@ -2002,7 +1995,7 @@ static void wxCanvasInputEvent(Widget drawingArea,
                                XmDrawingAreaCallbackStruct * cbs)
 {
     wxWindow *canvas = wxGetWindowFromTable(drawingArea);
-    XEvent local_event;
+    XEvent* xevent = cbs->event;
 
     if (canvas==NULL)
         return;
@@ -2010,27 +2003,25 @@ static void wxCanvasInputEvent(Widget drawingArea,
     if (cbs->reason != XmCR_INPUT)
         return;
 
-    local_event = *(cbs->event);    // We must keep a copy!
-
-    switch (local_event.xany.type)
+    switch (xevent->xany.type)
     {
     case EnterNotify:
     case LeaveNotify:
     case ButtonPress:
     case ButtonRelease:
     case MotionNotify:
-    {
-        wxMouseEvent wxevent;
-        if(wxTranslateMouseEvent(wxevent, canvas, drawingArea, &local_event))
         {
-            canvas->GetEventHandler()->ProcessEvent(wxevent);
+            wxMouseEvent wxevent(0);
+            if (wxTranslateMouseEvent(wxevent, canvas, drawingArea, xevent))
+            {
+                canvas->GetEventHandler()->ProcessEvent(wxevent);
+            }
+            break;
         }
-        break;
-    }
     case KeyPress:
         {
             wxKeyEvent event (wxEVT_CHAR);
-            if (wxTranslateKeyEvent (event, canvas, (Widget) 0, &local_event))
+            if (wxTranslateKeyEvent (event, canvas, (Widget) 0, xevent))
             {
                 // Implement wxFrame::OnCharHook by checking ancestor.
                 wxWindow *parent = canvas;
@@ -2060,7 +2051,7 @@ static void wxCanvasInputEvent(Widget drawingArea,
     case KeyRelease:
         {
             wxKeyEvent event (wxEVT_KEY_UP);
-            if (wxTranslateKeyEvent (event, canvas, (Widget) 0, &local_event))
+            if (wxTranslateKeyEvent (event, canvas, (Widget) 0, xevent))
             {
                 canvas->GetEventHandler()->ProcessEvent (event);
             }
@@ -2068,7 +2059,7 @@ static void wxCanvasInputEvent(Widget drawingArea,
         }
     case FocusIn:
         {
-            if (local_event.xfocus.detail != NotifyPointer)
+            if (xevent->xfocus.detail != NotifyPointer)
             {
                 wxFocusEvent event(wxEVT_SET_FOCUS, canvas->GetId());
                 event.SetEventObject(canvas);
@@ -2078,7 +2069,7 @@ static void wxCanvasInputEvent(Widget drawingArea,
         }
     case FocusOut:
         {
-            if (local_event.xfocus.detail != NotifyPointer)
+            if (xevent->xfocus.detail != NotifyPointer)
             {
                 wxFocusEvent event(wxEVT_KILL_FOCUS, canvas->GetId());
                 event.SetEventObject(canvas);
@@ -2218,7 +2209,7 @@ void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event,
 // ----------------------------------------------------------------------------
 
 bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
-                           Widget widget, XEvent *xevent)
+                           Widget widget, const XEvent *xevent)
 {
     switch (xevent->xany.type)
     {
@@ -2233,6 +2224,8 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
         case ButtonRelease:
         case MotionNotify:
         {
+            int eventx = xevent->xbutton.x, eventy = xevent->xbutton.y;
+
             wxEventType eventType = wxEVT_NULL;
 
             if (xevent->xany.type == LeaveNotify)
@@ -2246,6 +2239,18 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
             else if (xevent->xany.type == MotionNotify)
             {
                 eventType = wxEVT_MOTION;
+
+                if (xevent->xmotion.is_hint == NotifyHint)
+                {
+                    Window root, child;
+                    int x_root, y_root;
+                    unsigned int state;
+                    Display *dpy = XtDisplay (widget);
+
+                    XQueryPointer (dpy, XtWindow (widget),
+                        &root, &child,
+                        &x_root, &y_root, &eventx, &eventy, &state);
+                }
             }
             else if (xevent->xany.type == ButtonPress)
             {
@@ -2333,8 +2338,8 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
                 dy = y1;
             }
 
-            wxevent.m_x = xevent->xbutton.x + dx;
-            wxevent.m_y = xevent->xbutton.y + dy;
+            wxevent.m_x = eventx + dx;
+            wxevent.m_y = eventy + dy;
 
             wxevent.m_leftDown = ((eventType == wxEVT_LEFT_DOWN)
                 || (event_left_is_down (xevent)
@@ -2361,7 +2366,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
 }
 
 bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
-                         Widget WXUNUSED(widget), XEvent *xevent)
+                         Widget WXUNUSED(widget), const XEvent *xevent)
 {
     switch (xevent->xany.type)
     {