bool Consent::PromptUserFor (MoonConsentType consent, const char *question, const char *detail, const char *website) { bool remember = false; bool rv = false; MoonlightConfiguration configuration; char *config_key = GeneratePermissionConfigurationKey (consent, website); if (configuration.HasKey ("Permissions", config_key)) { rv = configuration.GetBooleanValue ("Permissions", config_key); g_free (config_key); return rv; } MoonWindowingSystem *windowing_system = runtime_get_windowing_system (); rv = windowing_system->ShowConsentDialog (question, detail, website, &remember); if (remember) { configuration.SetBooleanValue ("Permissions", config_key, rv); configuration.Save (); } g_free (config_key); return rv; }
guint TimeManager::AddTimeout (gint priority, guint ms_interval, MoonSourceFunc func, gpointer tick_data) { guint rv = runtime_get_windowing_system()->AddTimeout (priority, ms_interval, func, tick_data); registered_timeouts = g_list_prepend (registered_timeouts, GUINT_TO_POINTER (rv)); #if PUT_TIME_MANAGER_TO_SLEEP // note that we don't set any flags here, the timeouts are // handled outside of our Tick callback if (!source_tick_pending) { source_tick_pending = true; if (was_stopped) { TimeSpan diff = last_global_time - stop_time; if (diff > current_timeout) diff = current_timeout; source->SetTimerFrequency (current_timeout - diff / 10000); was_stopped = false; } else source->SetTimerFrequency (current_timeout); source->Start(); } #endif return rv; }
void TimeManager::RemoveAllRegisteredTimeouts () { GList *t; for (t = registered_timeouts; t; t = t->next) runtime_get_windowing_system ()->RemoveTimeout (GPOINTER_TO_UINT (t->data)); g_list_free (registered_timeouts); registered_timeouts = NULL; }
void BitmapImage::CreateLoader (unsigned char *buffer) { if (!(moonlight_flags & RUNTIME_INIT_ALL_IMAGE_FORMATS)) { // 89 50 4E 47 == png magic if (buffer[0] == 0x89) loader = runtime_get_windowing_system()->CreatePixbufLoader ("png"); // ff d8 ff e0 == jfif magic else if (buffer[0] == 0xff) loader = runtime_get_windowing_system()->CreatePixbufLoader ("jpeg"); else { Abort (); moon_error = new MoonError (MoonError::EXCEPTION, 4001, "unsupported image type"); } } else { loader = runtime_get_windowing_system()->CreatePixbufLoader (NULL); } }
void TimeManager::RemoveTimeout (guint timeout_id) { runtime_get_windowing_system ()->RemoveTimeout (timeout_id); registered_timeouts = g_list_remove_all (registered_timeouts, GUINT_TO_POINTER (timeout_id)); }