Opened 5 years ago

Last modified 5 years ago

#12068 reopened defect

wxMacWakeUp is not implemented for OSX iPhone in utils.mm

Reported by: ost@… Owned by: csomor
Priority: normal Milestone:
Component: wxOSX-iPhone Version:
Keywords: events Cc:
Blocked By: Blocking:
Patch: no

Description

The iPhone utils.mm has the following empty implementation:

void wxMacWakeUp()
{

TODO

}

This cause programs that do not use GUI objects but do use timers, sockets and general event handling not to work.

Change History (8)

comment:1 Changed 5 years ago by csomor

  • Resolution set to fixed
  • Status changed from new to closed

added common implementation

comment:2 Changed 5 years ago by ost@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

wxMacWakeUp now requires define of wxUSE_BASE but is referenced from places that do not require this so you can get unresolved external if using GUI

#if wxUSE_BASE

void wxMacWakeUp()
{

wxEventLoopBase * const loop = wxEventLoopBase::GetActive();

if ( loop )

loop->WakeUp();

}

#endif

comment:3 Changed 5 years ago by ost@…

Maybe its because of wxOSX_USE_COCOA_OR_CARBON, not sure

comment:4 Changed 5 years ago by csomor

  • Owner set to csomor
  • Status changed from reopened to accepted

we have WXDLLIMPEXP_BASE void wxMacWakeUp() ;

so it is correct to be defined in BASE, but it's inside the wrong guard, thanks

comment:5 Changed 5 years ago by SC

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [64348]) moving wxMacWakeUp outside COCOA_CARBON clause, fixes #12068

comment:6 Changed 5 years ago by ost@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

Now it does link but it does not work. I think the code assumes that wx event loop is used while in my app it is not. My temporary patch, that works, uses code from 2.8:

if (wxTheApp)
{

wxTheApp->ProcessPendingEvents();
wxTheApp->ProcessIdle();

}

Also I am making it thread safe by calling it from perform selector on main thread

comment:7 Changed 5 years ago by ost@…

Maybe this is not the problem (or not the only one). After the last update from trunk the above code do not work since wxMacWakeUp is not even called for socket, timer or wxPostEvent

comment:8 Changed 5 years ago by ost@…

going back to revision 64341 and this patch in src/osx/iphone/utils.mm works for me:

@interface wxWaker : NSObject

@end

@implementation wxWaker

  • (void)wakeUp

{

if (wxTheApp)
{

wxTheApp->ProcessPendingEvents();
wxTheApp->ProcessIdle();

}

}

@end

wxWaker* g_waker = nil;

void wxMacWakeUp()
{

if (g_waker == nil)
{

g_waker = [[wxWaker alloc] init];

}


[g_waker performSelectorOnMainThread:@selector(wakeUp) withObject:nil waitUntilDone:NO];

}

Note: See TracTickets for help on using tickets.