efl-mono: Fix using right description pointer in event registration

This commit is contained in:
Felipe Magno de Almeida 2017-12-20 19:45:07 -02:00
parent c3beffb3ca
commit 481853e1ed
2 changed files with 8 additions and 6 deletions

View File

@ -562,7 +562,7 @@ struct klass
<< scope_tab << scope_tab << "if (!event_cb_count.TryGetValue(key, out event_count))\n"
<< scope_tab << scope_tab << scope_tab << "event_cb_count[key] = event_count;\n"
<< scope_tab << scope_tab << "if (event_count == 0) {\n"
<< scope_tab << scope_tab << scope_tab << "efl.kw_event.Description desc = new efl.kw_event.Description(key);\n"
<< scope_tab << scope_tab << scope_tab << "IntPtr desc = efl.eo.Globals.dlsym(efl.eo.Globals.RTLD_DEFAULT, key);\n"
<< scope_tab << scope_tab << scope_tab << "bool result = efl.eo.Globals.efl_event_callback_priority_add(handle, desc, 0, evt_delegate, System.IntPtr.Zero);\n"
<< scope_tab << scope_tab << scope_tab << "if (!result) {\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "eina.Log.Error($\"Failed to add event proxy for event {key}\");\n"
@ -639,7 +639,7 @@ struct klass
<< scope_tab << "}\n"
<< scope_tab << "private void on_" << event_name << "_NativeCallback(System.IntPtr data, ref efl.Event evt)\n"
<< scope_tab << "{\n"
<< scope_tab << event_args
<< scope_tab << scope_tab << event_args
<< scope_tab << scope_tab << "try {\n"
<< scope_tab << scope_tab << scope_tab << "On_" << event_name << "(args);\n"
<< scope_tab << scope_tab << "} catch (Exception e) {\n"
@ -730,7 +730,7 @@ struct klass
<< scope_tab << "efl.Event_Cb evt_" << wrapper_evt_name << "_delegate;\n"
<< scope_tab << "private void on_" << wrapper_evt_name << "_NativeCallback(System.IntPtr data, ref efl.Event evt)"
<< scope_tab << "{\n"
<< scope_tab << event_args
<< scope_tab << scope_tab << event_args
<< scope_tab << scope_tab << "try {\n"
<< scope_tab << scope_tab << scope_tab << "On_" << wrapper_evt_name << "(args);\n"
<< scope_tab << scope_tab << "} catch (Exception e) {\n"

View File

@ -52,8 +52,9 @@ public class Globals {
[DllImport(efl.Libs.Eo)] public static extern bool efl_event_callback_priority_add(
System.IntPtr obj,
// FIXME commented to allow passing null stuff during test
/* ref efl.kw_event.Description desc, */
efl.kw_event.Description desc,
//ref efl.kw_event.Description desc,
//efl.kw_event.Description desc,
IntPtr desc,
short priority,
efl.Event_Cb cb,
System.IntPtr data);
@ -62,7 +63,8 @@ public class Globals {
efl.kw_event.Description desc,
efl.Event_Cb cb,
System.IntPtr data);
[DllImport(efl.Libs.Eo)] public static extern IntPtr
efl_object_legacy_only_event_description_get([MarshalAs(UnmanagedType.LPStr)] String name);
public const int RTLD_NOW = 2;