view plugins/crazychat/cc_interface.h @ 12115:e9790eb93216

[gaim-migrate @ 14415] quoth charkins: " This patch has a few small fixes for the visibility stuff in gtkblist.c. First, tracking of the ICONIFIED state of the blist was removed. This was intended to allow the blist to "remember" if it was minimized between restarts. Unfortunately, this is not possible because the ICONIFIED state gets set when the blist is on a different desktop with many window managers. Second, while talking about the ICONIFIED issue on #gtk@GIMPNet, muntyan_ asked about a bug where the blist would get shown on an account re-connect with 1.5.0. Luke mentioned something about this with cvs as well. This patch introduces a check in gaim_gtk_blist_show() to prevent the window from being shown if it already exists and is visible. Third, sadrul pointed me to a one-line fix for the missing blist on startup. I added a second line to make sure the blist restores its proper size as well. Finally, when the last visibility manager is removed, gaim will now minimize the blist if it was previously hidden, rather than showing it. This could prevent a race condition with out-of-process applets, preventing gaim from maintaining the visibility state properly between restarts. This was 'cvs diff'ed against the last available anon cvs from Friday. Hopefully it'll apply cleanly." it did. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 16 Nov 2005 17:55:26 +0000
parents 8bcd4d4ccef6
children
line wrap: on
line source

#ifndef __CC_INTERFACE_H__
#define __CC_INTERFACE_H__

#include <gtk/gtk.h>
#include "crazychat.h"

/* XXX feature encapsulation: still in flux, not stable XXX */

//charlie
typedef enum {REMOTE, LOCAL} OUTPUT;

gboolean configure(GtkWidget *widget,
				GdkEventConfigure *event, void *data);

#ifdef DISABLE_MODELS
#define draw(a, b, c)  1
#define setupDrawlists(a)
#else
gboolean draw(GtkWidget *widget, GdkEventExpose *event,
			      void *data);

void setupDrawlists(OUTPUT output);
#endif

void init (GtkWidget *widget, void *data);

void setupLighting(GtkWidget *widget);

struct cc_features {
	guint8 head_size;
	guint8 left_eye_open, right_eye_open;		/*booleans*/
	guint8 mouth_open;				/*percentage*/
	guint8 head_x_rot, head_y_rot, head_z_rot;	/* head rotation */
	guint8 x, y;					/*center of head*/
	guint8 head_color, appendage_color, lid_color, right_iris_color, left_iris_color; //colors
	guint8 mode, kind;
};

struct output_instance {
	struct cc_features *features;
	struct cc_session *session;
	float past_y;
	OUTPUT my_output;
	GtkWidget *widget;
	GtkWidget *box;
};

struct input_instance {
	int timer_id;
	struct cc_features face;
	GtkWidget *widget;
	GtkWidget *box;
	GtkWidget *button;
	GtkWidget *label;
	GtkWidget *model;
	GtkWidget *head, *appendage, *lid, *right_iris, *left_iris;
	struct output_instance output;
};

struct output_handlers {
	int (*configure)(GtkWidget *widget, GdkEventConfigure *event,
			void *data);
	void (*init) (GtkWidget *widget, void *data);
	gboolean (*draw) (GtkWidget *widget, GdkEventExpose *event, void *data);
};

struct cc_session {
	struct crazychat *cc;			/**< crazychat global data */
	char *name;				/**< session peer */
	guint32 peer_ip;			/**< peer's ip addr, nbo */
	guint16 peer_port;			/**< peer's port hbo */
	struct sockaddr_in peer;		/**< peer udp sock addr */
	CC_STATE state;				/**< connection state */
	int timer_id;				/**< glib timer callback id */
	int tcp_sock;				/**< tcp socket connection */
	int udp_sock;				/**< udp socket connection */
	struct cc_features features;		/**< network peer features */
	struct output_instance *output;		/**< output instance data */
	filter_bank *filter;			/**< filter instance */
};

struct crazychat {
	guint16 tcp_port;			/**< tcp port to bind on */
	guint16 udp_port;			/**< udp session data port */
	struct cc_session_node *sessions;	/**< list of sessions */
	struct input_instance *input_data;	/**< input instance data */
	gboolean features_state;		/**< features state on/off */
};

/* --- input feature interface --- */

#ifdef _DISABLE_QT_
#define init_input(a)				NULL
#define destroy_input(a)
#else

/**
 * Initializes the input subsystem.
 * @param cc		global crazychat data structure
 * @return		pointer to an input instance
 */
struct input_instance *init_input(struct crazychat *cc);

/**
 * Destroys the input subsystem.
 * @param instance	input instance
 */
void destroy_input(struct input_instance *instance);

#endif /* _DISABLE_QT_ */

/* --- output feature interface --- */

/**
 * Initializes an output instance.
 * @param features	pointer to features
 * @param session	pointer to the crazychat session
 * @return		pointer to the output instance
 */
struct output_instance *init_output(struct cc_features *features,
		struct cc_session *session);

/**
 * Destroys an output instance.
 * @param instance	output instance
 */
void destroy_output(struct output_instance *instance);

#endif