Kaydet (Commit) 06d8afc2 authored tarafından Caolán McNamara's avatar Caolán McNamara

Remove stuff that doesn't make sense since AnyInput change

Resolves: fdo#48011 writer idle-callbacks are halting when events pending
commit id: 658954e8

which isn't to pretend that its definitely the *right* fix

Change-Id: I228cf86b8e5eb0e4918c31e853a8d567831ce5e2
üst ed305e96
...@@ -147,9 +147,6 @@ public: ...@@ -147,9 +147,6 @@ public:
std::vector<GtkSalTimer *> m_aTimers; std::vector<GtkSalTimer *> m_aTimers;
bool IsTimerExpired(); 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; mutable boost::shared_ptr<vcl::unx::GtkPrintWrapper> m_pPrintWrapper;
}; };
......
...@@ -203,70 +203,9 @@ extern "C" ...@@ -203,70 +203,9 @@ extern "C"
} }
} }
// Handling the event queue #if GTK_CHECK_VERSION(3,0,0)
static sal_uInt16 categorizeEvent(const GdkEvent *pEvent)
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 )
{ {
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; sal_uInt16 nType = 0;
switch( pEvent->type ) switch( pEvent->type )
{ {
...@@ -292,18 +231,8 @@ extern "C" { ...@@ -292,18 +231,8 @@ extern "C" {
break; break;
} }
return 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 );
}
} }
#endif
GtkInstance::GtkInstance( SalYieldMutex* pMutex ) GtkInstance::GtkInstance( SalYieldMutex* pMutex )
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
...@@ -312,21 +241,16 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex ) ...@@ -312,21 +241,16 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex )
: X11SalInstance( pMutex ) : X11SalInstance( pMutex )
#endif #endif
{ {
resetEvents();
} }
// This has to happen after gtk_init has been called by saldata.cxx's // This has to happen after gtk_init has been called by saldata.cxx's
// Init or our handlers just get clobbered. // Init or our handlers just get clobbered.
void GtkInstance::Init() 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() 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() ) while( !m_aTimers.empty() )
delete *m_aTimers.begin(); delete *m_aTimers.begin();
DeInitAtkBridge(); DeInitAtkBridge();
...@@ -612,9 +536,6 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer) ...@@ -612,9 +536,6 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer)
void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
{ {
GetGtkSalData()->Yield( bWait, bHandleAllCurrentEvents ); GetGtkSalData()->Yield( bWait, bHandleAllCurrentEvents );
if( !gdk_events_pending() )
resetEvents();
} }
bool GtkInstance::IsTimerExpired() bool GtkInstance::IsTimerExpired()
......
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