X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f11c2334567bd440bb2676f43d3376badc921f2..77fe7204b5fa4d7f703a3d0bc2f1a4f0363f538d:/src/html/htmlwin.cpp

diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp
index 9478914c41..c437f70709 100644
--- a/src/html/htmlwin.cpp
+++ b/src/html/htmlwin.cpp
@@ -15,7 +15,7 @@
 
 #if wxUSE_HTML && wxUSE_STREAMS
 
-#ifndef WXPRECOMP
+#ifndef WX_PRECOMP
     #include "wx/list.h"
     #include "wx/log.h"
     #include "wx/intl.h"
@@ -953,6 +953,7 @@ bool wxHtmlWindow::CopySelection(ClipboardType t)
 void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
 {
     wxHtmlLinkEvent event(GetId(), link);
+    event.SetEventObject(this);
     if (!GetEventHandler()->ProcessEvent(event))
     {
         // the default behaviour is to load the URL in this window
@@ -1135,9 +1136,10 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event)
             CaptureMouse();
         }
     }
-#else
-    wxUnusedVar(event);
 #endif // wxUSE_CLIPBOARD
+
+    // in any case, let the default handler set focus to this window
+    event.Skip();
 }
 
 void wxHtmlWindow::OnMouseUp(wxMouseEvent& event)
@@ -1148,9 +1150,13 @@ void wxHtmlWindow::OnMouseUp(wxMouseEvent& event)
         ReleaseMouse();
         m_makingSelection = false;
 
-        // did the user move the mouse far enough from starting point?
-        if ( CopySelection(Primary) )
+        // if m_selection=NULL, the user didn't move the mouse far enough from
+        // starting point and the mouse up event is part of a click, the user
+        // is not selecting text:
+        if ( m_selection )
         {
+            CopySelection(Primary);
+
             // we don't want mouse up event that ended selecting to be
             // handled as mouse click and e.g. follow hyperlink:
             return;
@@ -1158,8 +1164,6 @@ void wxHtmlWindow::OnMouseUp(wxMouseEvent& event)
     }
 #endif // wxUSE_CLIPBOARD
 
-    SetFocus();
-
     wxPoint pos = CalcUnscrolledPosition(event.GetPosition());
     wxHtmlWindowMouseHelper::HandleMouseClick(m_Cell, pos, event);
 }