Kaydet (Commit) 658954e8 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#48011 writer idle-callbacks are halting when events pending

Writer does a lot of work, e.g. spell-checking, word counting etc. in
idle-callbacks. It halts work by checking for AnyInput, and if any input or
paint etc is pending the idle-callbacks stop. With gtk3 rework pending
events don't seem to be available quite right.
üst dfc7c67e
......@@ -147,9 +147,8 @@ bool X11SalInstance::AnyInput(sal_uInt16 nType)
Display *pDisplay = pData->GetSalDisplay()->GetDisplay();
sal_Bool bRet = sal_False;
if( (nType & VCL_INPUT_TIMER) && mpXLib->CheckTimeout( false ) )
if( (nType & VCL_INPUT_TIMER) && (mpXLib && mpXLib->CheckTimeout(false)) )
bRet = sal_True;
else if (XPending(pDisplay) )
{
PredicateReturn aInput;
......
......@@ -27,6 +27,7 @@
************************************************************************/
#include <stack>
#include <string.h>
#include <osl/module.h>
#define GLIB_DISABLE_DEPRECATION_WARNINGS
......@@ -264,12 +265,11 @@ extern "C" {
return GDK_FILTER_CONTINUE;
}
// And then again as they pop out of gdk and into gtk+
static void _sal_gtk_event_handler_fn (GdkEvent *pEvent, gpointer data)
static sal_uInt16 categorizeEvent(const GdkEvent *pEvent)
{
sal_uInt16 nType = 0;
switch( pEvent->type ) {
switch( pEvent->type )
{
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
......@@ -291,8 +291,16 @@ extern "C" {
nType = VCL_INPUT_OTHER;
break;
}
((GtkInstance *)data)->subtractEvent( nType );
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 );
}
}
......@@ -623,16 +631,38 @@ bool GtkInstance::AnyInput( sal_uInt16 nType )
{
if( (nType & VCL_INPUT_TIMER) && IsTimerExpired() )
return true;
else
{
#if !GTK_CHECK_VERSION(3,0,0)
bool bRet = X11SalInstance::AnyInput(nType);
#else
if (!gdk_events_pending())
return false;
if (nType == VCL_INPUT_ANY)
return true;
bool bRet = false;
sal_uInt16 nShift = 1;
for (int i = 0; i < 16; i++) {
bRet |= (nType & nShift) && m_nAnyInput[i] > 0;
nShift <<= 1;
std::stack<GdkEvent*> aEvents;
GdkEvent *pEvent = NULL;
while ((pEvent = gdk_event_get()))
{
aEvents.push(pEvent);
sal_uInt16 nEventType = categorizeEvent(pEvent);
if ( (nEventType & nType) || ( ! nEventType && (nType & VCL_INPUT_OTHER) ) )
{
bRet = true;
break;
}
return bRet;
}
while (!aEvents.empty())
{
pEvent = aEvents.top();
gdk_event_put(pEvent);
gdk_event_free(pEvent);
aEvents.pop();
}
#endif
return bRet;
}
GenPspGraphics *GtkInstance::CreatePrintGraphics()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment