Simply set window title to Infinity
This commit is contained in:
parent
4503286694
commit
a908de9415
|
@ -106,10 +106,6 @@ static gint32 get_color_interval() {
|
||||||
return aud_get_int(CFGID, "palette_time");
|
return aud_get_int(CFGID, "palette_time");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean must_show_title() {
|
|
||||||
return aud_get_bool(CFGID, "show_title");
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint32 get_max_fps() {
|
static gint32 get_max_fps() {
|
||||||
return aud_get_int(CFGID, "max_fps");
|
return aud_get_int(CFGID, "max_fps");
|
||||||
}
|
}
|
||||||
|
@ -124,7 +120,6 @@ static void init_params() {
|
||||||
params.get_scale = get_scale;
|
params.get_scale = get_scale;
|
||||||
params.get_effect_interval = get_effect_interval;
|
params.get_effect_interval = get_effect_interval;
|
||||||
params.get_color_interval = get_color_interval;
|
params.get_color_interval = get_color_interval;
|
||||||
params.must_show_title = must_show_title;
|
|
||||||
params.get_max_fps = get_max_fps;
|
params.get_max_fps = get_max_fps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,7 +229,6 @@ static const char * const defaults[] = {
|
||||||
"palette_time", "100",
|
"palette_time", "100",
|
||||||
"scale_factor", "1",
|
"scale_factor", "1",
|
||||||
"max_fps", "30",
|
"max_fps", "30",
|
||||||
"show_title", "true",
|
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ static gboolean sdl_init()
|
||||||
player->notify_critical_error(error_msg);
|
player->notify_critical_error(error_msg);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
SDL_SetWindowTitle(window, "Infinity");
|
||||||
return allocate_screen_and_texture();
|
return allocate_screen_and_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,11 +466,6 @@ void display_toggle_fullscreen(void)
|
||||||
SDL_ShowCursor(is_fullscreen);
|
SDL_ShowCursor(is_fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_set_title(const gchar *title) {
|
|
||||||
g_return_if_fail(window != NULL);
|
|
||||||
SDL_SetWindowTitle(window, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_save_screen(void)
|
void display_save_screen(void)
|
||||||
{
|
{
|
||||||
gchar name[256];
|
gchar name[256];
|
||||||
|
|
|
@ -83,7 +83,6 @@ void curve(t_effect *current_effect);
|
||||||
*/
|
*/
|
||||||
void display_toggle_fullscreen(void);
|
void display_toggle_fullscreen(void);
|
||||||
|
|
||||||
void display_set_title(const gchar *title);
|
|
||||||
void display_save_screen(void);
|
void display_save_screen(void);
|
||||||
void display_save_effect(t_effect *effect);
|
void display_save_effect(t_effect *effect);
|
||||||
void display_load_random_effect(t_effect *effect);
|
void display_load_random_effect(t_effect *effect);
|
||||||
|
|
|
@ -55,14 +55,11 @@ static gboolean visible;
|
||||||
static gboolean quiting;
|
static gboolean quiting;
|
||||||
static gboolean interactive_mode;
|
static gboolean interactive_mode;
|
||||||
static gboolean first_xevent;
|
static gboolean first_xevent;
|
||||||
static gchar *current_title;
|
|
||||||
static GTimer *title_timer;
|
|
||||||
|
|
||||||
static SDL_Thread *thread;
|
static SDL_Thread *thread;
|
||||||
|
|
||||||
static void check_events();
|
static void check_events();
|
||||||
static int renderer(void *);
|
static int renderer(void *);
|
||||||
static void set_title(void);
|
|
||||||
|
|
||||||
void infinity_init(InfParameters * _params, Player * _player)
|
void infinity_init(InfParameters * _params, Player * _player)
|
||||||
{
|
{
|
||||||
|
@ -104,10 +101,6 @@ void infinity_init(InfParameters * _params, Player * _player)
|
||||||
quiting = FALSE;
|
quiting = FALSE;
|
||||||
first_xevent = TRUE;
|
first_xevent = TRUE;
|
||||||
|
|
||||||
current_title = g_strdup("Infinity");
|
|
||||||
set_title();
|
|
||||||
title_timer = g_timer_new();
|
|
||||||
g_timer_start(title_timer);
|
|
||||||
display_load_random_effect(¤t_effect);
|
display_load_random_effect(¤t_effect);
|
||||||
|
|
||||||
thread = SDL_CreateThread(renderer, "infinity_renderer", NULL);
|
thread = SDL_CreateThread(renderer, "infinity_renderer", NULL);
|
||||||
|
@ -143,7 +136,6 @@ void infinity_finish(void)
|
||||||
*/
|
*/
|
||||||
g_usleep(1000000);
|
g_usleep(1000000);
|
||||||
display_quit();
|
display_quit();
|
||||||
g_timer_destroy(title_timer);
|
|
||||||
|
|
||||||
player->disable_plugin();
|
player->disable_plugin();
|
||||||
|
|
||||||
|
@ -246,22 +238,6 @@ static void check_events()
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
if (params->must_show_title()) {
|
|
||||||
if (g_timer_elapsed(title_timer, NULL) > 1.0) {
|
|
||||||
if (player->is_playing()) {
|
|
||||||
if (current_title)
|
|
||||||
g_free(current_title);
|
|
||||||
current_title = g_strdup(player->get_title());
|
|
||||||
} else {
|
|
||||||
if (current_title)
|
|
||||||
g_free(current_title);
|
|
||||||
current_title = g_strdup("Infinity");
|
|
||||||
}
|
|
||||||
set_title();
|
|
||||||
g_timer_reset(title_timer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
|
@ -428,8 +404,3 @@ static int renderer(void *arg)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_title(void)
|
|
||||||
{
|
|
||||||
display_set_title(current_title);
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ typedef struct _InfParameters {
|
||||||
gint32 (*get_bpp) (void); /* bytes per pixels. */
|
gint32 (*get_bpp) (void); /* bytes per pixels. */
|
||||||
gint32 (*get_effect_interval) (void);
|
gint32 (*get_effect_interval) (void);
|
||||||
gint32 (*get_color_interval) (void);
|
gint32 (*get_color_interval) (void);
|
||||||
gint32 (*must_show_title) (void);
|
|
||||||
gint32 (*get_max_fps) (void);
|
gint32 (*get_max_fps) (void);
|
||||||
} InfParameters;
|
} InfParameters;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 - Duilio Protti
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* The Rhythmbox authors hereby grant permission for non-GPL compatible
|
||||||
|
* GStreamer plugins to be used and distributed together with GStreamer
|
||||||
|
* and Rhythmbox. This permission is above and beyond the permissions granted
|
||||||
|
* by the GPL license by which Rhythmbox is covered. If you modify this code
|
||||||
|
* you may extend this exception to your version of the code, but you are not
|
||||||
|
* obligated to do so. If you do not wish to do so, delete this exception
|
||||||
|
* statement from your version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h> /* For strlen */
|
||||||
|
//#include <glib/gi18n-lib.h>
|
||||||
|
#include <gmodule.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include <plugins/rb-plugin-macros.h>
|
||||||
|
#include <lib/rb-debug.h>
|
||||||
|
#include <shell/rb-shell.h>
|
||||||
|
#include <widgets/rb-dialog.h>
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
|
|
||||||
|
#define RB_TYPE_INFINITY_PLUGIN (rb_infinity_plugin_get_type ())
|
||||||
|
#define rb_infinity_plugin(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_INFINITY_PLUGIN, RBInfinityPlugin))
|
||||||
|
#define rb_infinity_plugin_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_INFINITY_PLUGIN, RBInfinityPluginClass))
|
||||||
|
#define RB_IS_INFINITY_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_INFINITY_PLUGIN))
|
||||||
|
#define RB_IS_INFINITY_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_INFINITY_PLUGIN))
|
||||||
|
#define rb_infinity_plugin_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_INFINITY_PLUGIN, RBInfinityPluginClass))
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PeasExtensionBase parent;
|
||||||
|
} RBInfinityPlugin;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PeasExtensionBaseClass parent_class;
|
||||||
|
} RBInfinityPluginClass;
|
||||||
|
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||||
|
|
||||||
|
static void rb_infinity_plugin_init (RBInfinityPlugin *plugin);
|
||||||
|
|
||||||
|
RB_DEFINE_PLUGIN(RB_TYPE_INFINITY_PLUGIN, RBInfinityPlugin, rb_infinity_plugin,)
|
||||||
|
|
||||||
|
static gint32 get_width() { return 640; }
|
||||||
|
static void set_width(gint32 width) { g_message("set_width TODO"); }
|
||||||
|
static gint32 get_height() { return 480; }
|
||||||
|
static void set_height(gint32 height) { g_message("set_height TODO"); }
|
||||||
|
static gint32 get_scale() { return 1; }
|
||||||
|
static gint32 get_max_fps() { return 30; }
|
||||||
|
static gint32 get_effect_interval() { return 100; }
|
||||||
|
static gint32 get_color_interval() { return 100; }
|
||||||
|
|
||||||
|
static InfParameters params = {
|
||||||
|
.get_width = get_width,
|
||||||
|
.set_width = set_width,
|
||||||
|
.get_height = get_height,
|
||||||
|
.set_height = set_height,
|
||||||
|
.get_scale = get_scale,
|
||||||
|
.get_effect_interval = get_effect_interval,
|
||||||
|
.get_color_interval = get_color_interval,
|
||||||
|
.get_max_fps = get_max_fps
|
||||||
|
};
|
||||||
|
|
||||||
|
static void notify_critical_error (const gchar *message) { g_message("notify_critical_error TODO"); }
|
||||||
|
static void disable_plugin() { g_message("disable_plugin TODO"); }
|
||||||
|
|
||||||
|
static Player player = {
|
||||||
|
.notify_critical_error = notify_critical_error,
|
||||||
|
.disable_plugin = disable_plugin
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
rb_infinity_plugin_init (RBInfinityPlugin *plugin)
|
||||||
|
{
|
||||||
|
g_message("RBInfinityPlugin initialising");
|
||||||
|
rb_debug ("RBInfinityPlugin initialising");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
impl_activate (PeasActivatable *plugin)
|
||||||
|
{
|
||||||
|
RBShell *shell;
|
||||||
|
|
||||||
|
g_object_get (plugin, "object", &shell, NULL);
|
||||||
|
g_message("Infinity plugin activated, with shell %p", shell);
|
||||||
|
//rb_error_dialog (NULL, "Sample Plugin", "Sample plugin activated, with shell %p", shell);
|
||||||
|
g_object_unref (shell);
|
||||||
|
infinity_init(¶ms, &player);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
impl_deactivate (PeasActivatable *plugin)
|
||||||
|
{
|
||||||
|
g_message("Infinity plugin deactivated");
|
||||||
|
//rb_error_dialog (NULL, "Sample Plugin", "Sample plugin deactivated");
|
||||||
|
infinity_finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//G_MODULE_EXPORT void
|
||||||
|
EXPORT void
|
||||||
|
peas_register_types (PeasObjectModule *module)
|
||||||
|
{
|
||||||
|
rb_infinity_plugin_register_type (G_TYPE_MODULE (module));
|
||||||
|
peas_object_module_register_extension_type (module,
|
||||||
|
PEAS_TYPE_ACTIVATABLE,
|
||||||
|
RB_TYPE_INFINITY_PLUGIN);
|
||||||
|
}
|
Loading…
Reference in New Issue