From d34958e8712f2c1d0f69567fd9c9ca95f33aae21 Mon Sep 17 00:00:00 2001 From: dmg Date: Tue, 18 May 2021 23:49:59 +0300 Subject: [PATCH] GLib.Idle.Add: use expected default priority, add priority overload --- Source/Libs/GLibSharp/Idle.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Libs/GLibSharp/Idle.cs b/Source/Libs/GLibSharp/Idle.cs index db65c5205..51724dd19 100644 --- a/Source/Libs/GLibSharp/Idle.cs +++ b/Source/Libs/GLibSharp/Idle.cs @@ -73,19 +73,24 @@ namespace GLib { delegate uint d_g_idle_add_full(int priority, IdleHandlerInternal d, IntPtr data, DestroyNotify notify); static d_g_idle_add_full g_idle_add_full = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_idle_add_full")); - public static uint Add (IdleHandler hndlr) + public static uint Add (int priority, IdleHandler hndlr) { IdleProxy p = new IdleProxy (hndlr); lock (p) { var gch = GCHandle.Alloc(p); var userData = GCHandle.ToIntPtr(gch); - p.ID = g_idle_add_full (0, (IdleHandlerInternal) p.proxy_handler, userData, DestroyHelper.NotifyHandler); + p.ID = g_idle_add_full (priority, (IdleHandlerInternal) p.proxy_handler, userData, DestroyHelper.NotifyHandler); } return p.ID; } + public static uint Add (IdleHandler hndlr) + { + return Add ((int)Priority.DefaultIdle, hndlr); + } + public static void Remove (uint id) { Source.Remove (id);