Commit 22ac4d8c authored by pavlov%netscape.com's avatar pavlov%netscape.com
Browse files

fix for 14292, 4289, 13051

parent 66cd71e3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ nsToolkit::nsToolkit()
//-------------------------------------------------------------------------
nsToolkit::~nsToolkit()
{
  if (mSharedGC)
    gdk_gc_unref(mSharedGC);
}

//-------------------------------------------------------------------------
@@ -58,12 +60,12 @@ void nsToolkit::CreateSharedGC(void)
  pixmap = ::gdk_pixmap_new (NULL, 1, 1, gdk_rgb_get_visual()->depth);
  mSharedGC = ::gdk_gc_new (pixmap);
  gdk_pixmap_unref (pixmap);
  mSharedGC = gdk_gc_ref(mSharedGC);
}

GdkGC *nsToolkit::GetSharedGC(void)
{
  mSharedGC = gdk_gc_ref(mSharedGC);
  return mSharedGC;
  return gdk_gc_ref(mSharedGC);
}

//-------------------------------------------------------------------------
+20 −16
Original line number Diff line number Diff line
@@ -1345,17 +1345,15 @@ nsWidget::OnMotionNotifySignal(GdkEventMotion * aGdkMotionEvent)

    event.point.x = nscoord(x);
    event.point.y = nscoord(y);

    event.widget = this;
  }

#if 0
  if (nsnull != sButtonMotionTarget)
  if (sButtonMotionTarget)
  {
    gint diffX;
    gint diffY;

    if (aGdkMotionEvent != NULL) 
    if (aGdkMotionEvent) 
    {
      // Compute the difference between the original root coordinates
      diffX = (gint) aGdkMotionEvent->x_root - sButtonMotionRootX;
@@ -1373,21 +1371,25 @@ nsWidget::OnMotionNotifySignal(GdkEventMotion * aGdkMotionEvent)
  {
    event.widget = this;

    if (aGdkMotionEvent != NULL) 
    if (aGdkMotionEvent)
    {
      event.point.x = nscoord(aGdkMotionEvent->x);
      event.point.y = nscoord(aGdkMotionEvent->y);
      event.point.x = nscoord(x);
      event.point.y = nscoord(y);
    }
  }

  if (aGdkMotionEvent != NULL) 
  if (aGdkMotionEvent)
  {
    event.time = aGdkMotionEvent->time;
  }
#endif

  printf("x=%i , y=%i target=%p\n", event.point.x, event.point.y, event.widget);

  AddRef();

  if (sButtonMotionTarget)
    sButtonMotionTarget->DispatchMouseEvent(event);
  else
    DispatchMouseEvent(event);

  Release();
@@ -1715,8 +1717,16 @@ nsWidget::OnButtonReleaseSignal(GdkEventButton * aGdkButtonEvent)
    break;
	}


  InitMouseEvent(aGdkButtonEvent, event, eventType);

  event.widget = sButtonMotionTarget ? sButtonMotionTarget : this;

  NS_ADDREF(event.widget);
  NS_STATIC_CAST(nsWidget*,event.widget)->DispatchMouseEvent(event);
  NS_IF_RELEASE(event.widget);


  if (sButtonMotionTarget)
  {
    sButtonMotionTarget = nsnull;
@@ -1724,12 +1734,6 @@ nsWidget::OnButtonReleaseSignal(GdkEventButton * aGdkButtonEvent)
    sButtonMotionRootX = -1;
    sButtonMotionRootY = -1;
  }

  AddRef();

  DispatchMouseEvent(event);

  Release();
}
//////////////////////////////////////////////////////////////////////
/* virtual */ void