]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/window.cpp
unused variable warning fix (patch 923094)
[wxWidgets.git] / src / motif / window.cpp
index 0a70d435a5c8b6ec70e46790a66bf758bbd7b0a3..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 )
@@ -1411,6 +1404,7 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
                 w -= 2 * (thick + margin);
             }
 
+            if( w < 1 ) w = 1;
             XtVaSetValues ((Widget) m_scrolledWindow, XmNwidth, w, NULL);
         }
 
@@ -1427,6 +1421,7 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
                 h -= 2 * (thick + margin);
             }
 
+            if( h < 1 ) h = 1;
             XtVaSetValues ((Widget) m_scrolledWindow, XmNheight, h, NULL);
         }
 
@@ -1577,14 +1572,6 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
     XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
 }
 
-void wxWindow::Clear()
-{
-    wxClientDC dc(this);
-    wxBrush brush(GetBackgroundColour(), wxSOLID);
-    dc.SetBackground(brush);
-    dc.Clear();
-}
-
 void wxWindow::DoPaint()
 {
     //TODO : make a temporary gc so we can do the XCopyArea below
@@ -2008,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;
@@ -2016,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;
@@ -2066,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);
             }
@@ -2074,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);
@@ -2084,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);
@@ -2224,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)
     {
@@ -2239,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)
@@ -2252,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)
             {
@@ -2339,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)
@@ -2367,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)
     {