[Libreoffice-commits] .: 5 commits - jvmfwk/source sw/source vcl/inc vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Sat Apr 28 13:16:03 PDT 2012


 jvmfwk/source/framework.cxx          |    1 
 sw/source/ui/docvw/AnnotationWin.cxx |   19 ++++-
 sw/source/ui/docvw/SidebarWin.cxx    |    5 -
 vcl/inc/unx/gtk/gtkinst.hxx          |    3 
 vcl/inc/unx/salinst.h                |    2 
 vcl/unx/gtk/app/gtkinst.cxx          |  131 ++++++-----------------------------
 6 files changed, 45 insertions(+), 116 deletions(-)

New commits:
commit ddc7bf61113328feb05252f57a4286574c69e521
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 28 20:55:00 2012 +0100

    valgrind: uninitialized variable
    
    Change-Id: I3bae6d746d63d52a09e7209f7565d60c834ce7c0

diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 7ca4bf4..7d8b45e 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -45,7 +45,7 @@ class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance
 protected:
     SalXLib *mpXLib;
 public:
-    X11SalInstance( SalYieldMutex* pMutex ) : SalGenericInstance( pMutex ) {}
+    X11SalInstance( SalYieldMutex* pMutex ) : SalGenericInstance( pMutex ), mpXLib(NULL) {}
     virtual ~X11SalInstance();
 
     virtual SalFrame*           CreateChildFrame( SystemParentData* pParent, sal_uIntPtr nStyle );
commit 4f42beedc34837da5d1f4cc26405e5f998b005d1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 28 20:51:37 2012 +0100

    Resolves: fdo#33599 cursor in notes is reset to start on focus out/focus in
    
    SidebarTxtControl::LoseFocus calls mrSidebarWin.UpdateData which takes the text
    from the postit if the postit has been modified and updates the field from it.
    That updates all listeners of that field which includes the postit itself,
    which in response updates its content from the field, which causes the cursor
    to be disabled, i.e the original contents have been removed and replaced with
    identical content, but the selection has been invalidated.
    
    Change-Id: Idcde25a85a3a657a6057e70a59e2219e224e009e

diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
index a4cee7e..898b73e 100644
--- a/sw/source/ui/docvw/AnnotationWin.cxx
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -86,23 +86,38 @@ SwAnnotationWin::~SwAnnotationWin()
 
 void SwAnnotationWin::SetPostItText()
 {
+    //If the cursor was visible, then make it visible again after
+    //changing text, e.g. fdo#33599
+    Cursor *pCursor = GetOutlinerView()->GetEditView().GetCursor();
+    bool bCursorVisible = pCursor ? pCursor->IsVisible() : false;
+
+    //If the new text is the same as the old text, keep the same insertion
+    //point .e.g. fdo#33599
+    mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
+    rtl::OUString sNewText = mpFld->GetPar2();
+    bool bTextUnchanged = sNewText.equals(Engine()->GetEditEngine().GetText());
+    ESelection aOrigSelection(GetOutlinerView()->GetEditView().GetSelection());
+
     // get text from SwPostItField and insert into our textview
     Engine()->SetModifyHdl( Link() );
     Engine()->EnableUndo( sal_False );
-    mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
     if( mpFld->GetTextObject() )
         Engine()->SetText( *mpFld->GetTextObject() );
     else
     {
         Engine()->Clear();
         GetOutlinerView()->SetAttribs(DefaultItem());
-        GetOutlinerView()->InsertText(mpFld->GetPar2(),false);
+        GetOutlinerView()->InsertText(sNewText,false);
     }
 
     Engine()->ClearModifyFlag();
     Engine()->GetUndoManager().Clear();
     Engine()->EnableUndo( sal_True );
     Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+    if (bTextUnchanged)
+        GetOutlinerView()->GetEditView().SetSelection(aOrigSelection);
+    if (bCursorVisible)
+        GetOutlinerView()->ShowCursor();
     Invalidate();
 }
 
commit 9a99c835bf35c754d5214b35e65c5eaf80707ab4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 28 20:46:02 2012 +0100

    remove no-opt debug breakpoint
    
    Change-Id: I4ad5ca0bb27569442812ddf0c5cff101e96d4d84

diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
index a03c5ac..606ee29 100644
--- a/sw/source/ui/docvw/SidebarWin.cxx
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -1018,11 +1018,6 @@ IMPL_LINK( SwSidebarWin, WindowEventListener, VclSimpleEvent*, pEvent )
             mrView.GetWrtShell().LockView( bLockView );
             mrMgr.MakeVisible( this );
         }
-        else if ( pWinEvent->GetWindow() == mpSidebarTxtControl )
-        {
-            int i = 5;
-            ++i;
-        }
     }
     return sal_True;
 }
commit 7038bc4a2d773004fc1d336dee034113b00153cf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 27 16:15:52 2012 +0100

    make java startup a visible event when debugging
    
    Change-Id: I97c5499b57edbaac6e356450bb9d89dc350260eb

diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 0fc3b5a..743bc8a 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -401,6 +401,7 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
 
         //start Java
         JavaVM *pVm = NULL;
+        SAL_WARN("jvmfwk", "starting java");
         javaPluginError plerr = (*pFunc)(aInfo, arOpt, index, & pVm, ppEnv);
         if (plerr == JFW_PLUGIN_E_VM_CREATION_FAILED)
         {
commit 06d8afc2292c66738b460d7fd8324fc53721d949
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 27 14:34:00 2012 +0100

    Remove stuff that doesn't make sense since AnyInput change
    
    Resolves: fdo#48011 writer idle-callbacks are halting when events pending
    commit id: 658954e8b50fc264428402dc5a95b0d6f690d191
    
    which isn't to pretend that its definitely the *right* fix
    
    Change-Id: I228cf86b8e5eb0e4918c31e853a8d567831ce5e2

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 331bcff..89743ca 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -147,9 +147,6 @@ public:
     std::vector<GtkSalTimer *>  m_aTimers;
     bool                        IsTimerExpired();
 
-    // count of in-flight un-dispatched gdk events of a given input type
-    sal_uInt32                  m_nAnyInput[16];
-    void                        resetEvents();
     mutable boost::shared_ptr<vcl::unx::GtkPrintWrapper> m_pPrintWrapper;
 };
 
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index c78de14..845e2fc 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -203,107 +203,36 @@ extern "C"
     }
 }
 
-// Handling the event queue
-
-void GtkInstance::resetEvents()
-{
-    memset( m_nAnyInput, 0, sizeof( m_nAnyInput ) );
-}
-
-void GtkInstance::addEvent( sal_uInt16 nMask )
-{
-    sal_uInt16 nShift = 1;
-    for (int i = 0; i < 16; i++) {
-        if( nMask & nShift )
-            m_nAnyInput[i]++;
-        nShift <<= 1;
-    }
-}
-
-void GtkInstance::subtractEvent( sal_uInt16 nMask )
+#if GTK_CHECK_VERSION(3,0,0)
+static sal_uInt16 categorizeEvent(const GdkEvent *pEvent)
 {
-    sal_uInt16 nShift = 1;
-    for (int i = 0; i < 16; i++) {
-        if( nMask & nShift && m_nAnyInput[i] > 0 )
-            m_nAnyInput[i]--;
-        nShift <<= 1;
-    }
-}
-
-extern "C" {
-    // We catch events as they pop out of X and into gdk
-    static GdkFilterReturn _sal_gtk_instance_filter_fn (GdkXEvent *_xevent,
-                                                        GdkEvent *event,
-                                                        gpointer  data)
-    {
-        (void)event;
-        // FIXME: in theory this could be for non-X events but in reality it never is.
-        XEvent *pXEvent = (XEvent *)_xevent;
-        sal_uInt16 nType;
-        switch( pXEvent->type ) {
-        case ButtonPress:
-        case ButtonRelease:
-        case MotionNotify:
-        case EnterNotify:
-        case LeaveNotify:
-            nType = VCL_INPUT_MOUSE;
-            break;
-        case XLIB_KeyPress:
-            nType = VCL_INPUT_KEYBOARD;
-            break;
-        case Expose:
-        case GraphicsExpose:
-        case NoExpose:
-            nType = VCL_INPUT_PAINT;
-            break;
-        default:
-            nType = VCL_INPUT_OTHER;
-            break;
-        }
-        ((GtkInstance *)data)->addEvent( nType );
-
-        return GDK_FILTER_CONTINUE;
-    }
-
-    static sal_uInt16 categorizeEvent(const GdkEvent *pEvent)
+    sal_uInt16 nType = 0;
+    switch( pEvent->type )
     {
-        sal_uInt16 nType = 0;
-        switch( pEvent->type )
-        {
-        case GDK_MOTION_NOTIFY:
-        case GDK_BUTTON_PRESS:
-        case GDK_2BUTTON_PRESS:
-        case GDK_3BUTTON_PRESS:
-        case GDK_BUTTON_RELEASE:
-        case GDK_ENTER_NOTIFY:
-        case GDK_LEAVE_NOTIFY:
-        case GDK_SCROLL:
-            nType = VCL_INPUT_MOUSE;
-            break;
-        case GDK_KEY_PRESS:
-        case GDK_KEY_RELEASE:
-            nType = VCL_INPUT_KEYBOARD;
-            break;
-        case GDK_EXPOSE:
-            nType = VCL_INPUT_PAINT;
-            break;
-        default:
-            nType = VCL_INPUT_OTHER;
-            break;
-        }
-        return nType;
-    }
-
-
-    // And then again as they pop out of gdk and into gtk+
-
-    static void _sal_gtk_event_handler_fn (GdkEvent *pEvent, gpointer data)
-    {
-        sal_uInt16 nType = categorizeEvent(pEvent);
-        ((GtkInstance *)data)->subtractEvent( nType );
-        gtk_main_do_event( pEvent );
+    case GDK_MOTION_NOTIFY:
+    case GDK_BUTTON_PRESS:
+    case GDK_2BUTTON_PRESS:
+    case GDK_3BUTTON_PRESS:
+    case GDK_BUTTON_RELEASE:
+    case GDK_ENTER_NOTIFY:
+    case GDK_LEAVE_NOTIFY:
+    case GDK_SCROLL:
+        nType = VCL_INPUT_MOUSE;
+        break;
+    case GDK_KEY_PRESS:
+    case GDK_KEY_RELEASE:
+        nType = VCL_INPUT_KEYBOARD;
+        break;
+    case GDK_EXPOSE:
+        nType = VCL_INPUT_PAINT;
+        break;
+    default:
+        nType = VCL_INPUT_OTHER;
+        break;
     }
+    return nType;
 }
+#endif
 
 GtkInstance::GtkInstance( SalYieldMutex* pMutex )
 #if GTK_CHECK_VERSION(3,0,0)
@@ -312,21 +241,16 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex )
     : X11SalInstance( pMutex )
 #endif
 {
-    resetEvents();
 }
 
 // This has to happen after gtk_init has been called by saldata.cxx's
 // Init or our handlers just get clobbered.
 void GtkInstance::Init()
 {
-    gdk_window_add_filter( NULL, _sal_gtk_instance_filter_fn, this );
-    gdk_event_handler_set( _sal_gtk_event_handler_fn, this, NULL );
 }
 
 GtkInstance::~GtkInstance()
 {
-    gdk_event_handler_set( (GdkEventFunc)gtk_main_do_event, NULL, NULL );
-    gdk_window_remove_filter( NULL, _sal_gtk_instance_filter_fn, this );
     while( !m_aTimers.empty() )
         delete *m_aTimers.begin();
     DeInitAtkBridge();
@@ -612,9 +536,6 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer)
 void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
 {
     GetGtkSalData()->Yield( bWait, bHandleAllCurrentEvents );
-
-    if( !gdk_events_pending() )
-        resetEvents();
 }
 
 bool GtkInstance::IsTimerExpired()


More information about the Libreoffice-commits mailing list