Enlightenment CVS committal
Author : sarajervi
Project : misc
Module : erss
Dir : misc/erss/src
Modified Files:
Makefile.am erss.c erss.h parse.c parse.h parse_config.c
parse_config.h
Added Files:
tooltip.c tooltip.h
Log Message:
More tooltip code..
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 23 Jan 2004 00:22:53 -0000 1.4
+++ Makefile.am 24 Jan 2004 18:04:35 -0000 1.5
@@ -4,6 +4,6 @@
bin_PROGRAMS = erss
-erss_SOURCES = erss.c parse.c parse_config.c
+erss_SOURCES = erss.c parse.c parse_config.c tooltip.c
erss_LDADD = @edje_libs@ @esmart_libs@ @ewd_libs@ @etox_libs@ @xml2_libs@
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- erss.c 23 Jan 2004 00:22:57 -0000 1.25
+++ erss.c 24 Jan 2004 18:04:35 -0000 1.26
@@ -1,6 +1,7 @@
#include "erss.h"
#include "parse.h"
#include "parse_config.h"
+#include "tooltip.h"
Evas *evas = NULL;
Ecore_Evas *ee = NULL;
@@ -17,7 +18,7 @@
int waiting_for_reply = FALSE;
int total_connects = 0;
-Erss_Tooltip *tt = NULL;
+int world_x, world_y;
void erss_xml_error_handler (void *ctx, const char *msg, ...)
@@ -116,7 +117,7 @@
return TRUE;
}
-int handler_signal_exit (void *data, int ev_type, void *ev)
+int erss_handler_signal_exit (void *data, int ev_type, void *ev)
{
Ecore_Event_Signal_Exit *e = ev;
@@ -132,9 +133,9 @@
return 1;
}
-int handler_server_add (void *data, int type, void *event)
+int erss_handler_server_add (void *data, int type, void *event)
{
- Article *ptr;
+ Erss_Article *ptr;
char c[1024];
/*
@@ -195,7 +196,7 @@
return 1;
}
-int handler_server_data (void *data, int type, void *event)
+int erss_handler_server_data (void *data, int type, void *event)
{
Ecore_Con_Event_Server_Data *e = event;
@@ -213,7 +214,7 @@
return 1;
}
-int handler_server_del (void *data, int type, void *event)
+int erss_handler_server_del (void *data, int type, void *event)
{
Ecore_Con_Event_Server_Del *e = event;
char *buf = main_buffer;
@@ -262,17 +263,21 @@
return 1;
}
-void erss_window_move (Ecore_Evas * ee)
+void erss_window_move (Ecore_Evas *ee)
{
int x, y, w, h;
Evas_Object *o = NULL;
-
+
ecore_evas_geometry_get (ee, &x, &y, &w, &h);
if((o = evas_object_name_find(ecore_evas_get(ee), "root_background")))
- esmart_trans_x11_freshen(o, x, y, w, h);
-}
+ esmart_trans_x11_freshen(o, x, y, w, h);
+
+ world_x = x;
+ world_y = y;
+}
+
void erss_window_resize(Ecore_Evas *ee)
{
int x, y, w, h;
@@ -295,11 +300,10 @@
evas_object_resize(o, w, h);
}
-
-void cb_mouse_out_item (void *data, Evas_Object *o, const char *sig,
+void erss_mouse_click_item (void *data, Evas_Object *o, const char *sig,
const char *src)
{
- Article *item = data;
+ Erss_Article *item = data;
char c[1024];
if (!rc->browser) {
@@ -311,102 +315,24 @@
ecore_exe_run (c, NULL);
}
-
-int erss_tooltip_timer (void *data)
-{
- Article *item = data;
- int x, y, w, h;
-
- tt->timer = NULL;
-
- if (!item->description)
- return FALSE;
-
- printf ("Opening tooltip after %lf secs\n", 1.5);
-
-
- if (!tt->ee) {
- tt->ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, 350, 200);
- ecore_evas_borderless_set (tt->ee, TRUE);
- ecore_evas_shaped_set (tt->ee, TRUE);
- tt->win = ecore_evas_software_x11_window_get(ee);
- ecore_x_window_prop_window_type_utility_set (tt->win);
- ecore_evas_geometry_get (tt->ee, &x, &y, &w, &h);
-
- tt->evas = ecore_evas_get (tt->ee);
- evas_font_path_append (tt->evas, PACKAGE_DATA_DIR"/fonts/");
-
-
- tt->bg = esmart_trans_x11_new (tt->evas);
- evas_object_move (tt->bg, 0, 0);
- evas_object_layer_set (tt->bg, -5);
- evas_object_resize (tt->bg, w, h);
- evas_object_name_set(tt->bg, "root_background");
- evas_object_show (tt->bg);
-
- tt->bg = evas_object_rectangle_add(tt->evas);
- evas_object_move (tt->bg, 0, 0);
- evas_object_layer_set (tt->bg, -6);
- evas_object_resize (tt->bg, w, h);
- evas_object_color_set(tt->bg, 255, 255, 255, 0);
- evas_object_name_set(tt->bg, "background");
- evas_object_show (tt->bg);
-
- tt->etox = etox_new_all(tt->evas, x, y, w, h , 255, ETOX_ALIGN_LEFT);
- etox_context_set_align(etox_get_context(tt->etox), ETOX_ALIGN_LEFT);
- etox_context_set_font(etox_get_context(tt->etox), "Vera", 10);
- etox_context_set_style(etox_get_context(tt->etox), "shadow");
- etox_context_set_color(etox_get_context(tt->etox), 225, 225, 225, 255);
- etox_set_soft_wrap(tt->etox, 1);
- etox_set_alpha(tt->etox, 255);
- evas_object_layer_set(tt->etox, 1000);
- etox_set_text (tt->etox, item->description);
- evas_object_show (tt->etox);
-
-
- ecore_evas_callback_move_set (tt->ee, erss_window_move);
- ecore_evas_callback_resize_set(tt->ee, erss_window_resize);
- }
-
- ecore_evas_show (tt->ee);
-
- return FALSE;
-}
-
-void cb_mouse_in (void *data, Evas *e, Evas_Object *obj,
- void *event_info)
+void erss_mouse_in_cursor_change (void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
{
- Evas_Event_Mouse_In *event = event_info;
- Article *item = data;
- Ecore_X_Window win;
-
- /*
- printf ("x: %d y: %d\n", event->output.x, event->output.y);
- */
+ Ecore_X_Window win;
- tt->timer = ecore_timer_add (1.5, erss_tooltip_timer, item);
-
win = ecore_evas_software_x11_window_get(ee);
if (cfg->item_url)
- ecore_x_cursor_shape_set(win, ECORE_X_CURSOR_HAND2);
+ ecore_x_cursor_shape_set(win, ECORE_X_CURSOR_HAND2);
}
-void cb_mouse_out (void *data, Evas *e, Evas_Object *obj,
- void *event_info)
+void erss_mouse_out_cursor_change (void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
{
- Ecore_X_Window win;
-
- if (tt->ee)
- ecore_evas_hide (tt->ee);
-
- if (tt->timer) {
- ecore_timer_del (tt->timer);
- tt->timer = NULL;
- }
-
- win = ecore_evas_software_x11_window_get(ee);
+ Ecore_X_Window win;
+
+ win = ecore_evas_software_x11_window_get(ee);
ecore_x_cursor_set(win, 0);
-}
+}
void erss_list_config_files (int output)
@@ -521,6 +447,7 @@
int height;
int width;
int c = 0;
+ char *xdisplay = NULL;
int got_config_file = FALSE;
int got_theme_file = FALSE;
@@ -606,29 +533,23 @@
}
ecore_init ();
+ ecore_x_init (xdisplay);
- if (!ecore_con_init ())
- return -1;
+ if (!ecore_con_init ()) return -1;
+
ecore_app_args_set (argc, (const char **) argv);
- if (!ecore_evas_init ())
- return -1;
+ if (!ecore_evas_init ()) return -1;
width = 300;
height = 16 * cfg->num_stories;
- if (cfg->header)
- height += 26;
-
- if (cfg->clock)
- height += 26;
+ if (cfg->header) height += 26;
+ if (cfg->clock) height += 26;
ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, width, height);
win = ecore_evas_software_x11_window_get(ee);
ecore_x_window_prop_window_type_desktop_set(win);
-
- tt = malloc (sizeof (Erss_Tooltip));
- memset(tt, 0, sizeof (Erss_Tooltip));
if (!ee)
return -1;
@@ -647,11 +568,11 @@
evas_font_path_append (evas, PACKAGE_DATA_DIR"/fonts/");
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
- handler_server_add, NULL);
+ erss_handler_server_add,
NULL);
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
- handler_server_del, NULL);
+ erss_handler_server_del,
NULL);
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
- handler_server_data, NULL);
+ erss_handler_server_data,
NULL);
ecore_evas_geometry_get (ee, &x, &y, &w, &h);
@@ -671,7 +592,8 @@
evas_object_show (bg);
ecore_event_handler_add (ECORE_EVENT_SIGNAL_EXIT,
- handler_signal_exit, NULL);
+ erss_handler_signal_exit,
NULL);
+
ecore_evas_callback_move_set (ee, erss_window_move);
ecore_evas_callback_resize_set(ee, erss_window_resize);
@@ -714,7 +636,8 @@
ecore_main_loop_begin ();
ecore_evas_shutdown ();
+ ecore_x_shutdown ();
ecore_shutdown ();
- return 0;
+ return FALSE;
}
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- erss.h 23 Jan 2004 00:22:57 -0000 1.9
+++ erss.h 24 Jan 2004 18:04:56 -0000 1.10
@@ -32,24 +32,13 @@
#include "config.h"
-typedef struct _erss_tooltip Erss_Tooltip;
-
-struct _erss_tooltip {
- Evas *evas;
- Ecore_Evas *ee;
- Ecore_X_Window win;
- Evas_Object *bg;
- Evas_Object *etox;
-
- Ecore_Timer *timer;
-};
-
extern Evas *evas;
extern Ecore_Evas *ee;
extern Ewd_List *list;
extern Evas_Object *cont;
extern Ewd_List *config_files;
-
+extern int world_x;
+extern int world_y;
void erss_xml_error_handler (void *ctx, const char *msg, ...);
int erss_connect (void *data);
@@ -58,19 +47,20 @@
char *erss_time_format ();
int erss_set_time (void *data);
-int handler_signal_exit (void *data, int ev_type, void *ev);
-int handler_server_add (void *data, int type, void *event);
-int handler_server_data (void *data, int type, void *event);
-int handler_server_del (void *data, int type, void *event);
+int erss_handler_signal_exit (void *data, int ev_type, void *ev);
+int erss_handler_server_add (void *data, int type, void *event);
+int erss_handler_server_data (void *data, int type, void *event);
+int erss_handler_server_del (void *data, int type, void *event);
void erss_window_move (Ecore_Evas * ee);
void erss_window_resize (Ecore_Evas *ee);
-void cb_mouse_out_item (void *data, Evas_Object *o,
+void erss_mouse_click_item (void *data, Evas_Object *o,
const char *sig, const char *src);
-void cb_mouse_in (void *data, Evas *e, Evas_Object *obj, void *event_info);
-void cb_mouse_out (void *data, Evas *e, Evas_Object *obj, void *event_info);
-
+void erss_mouse_in_cursor_change (void *data, Evas *e, Evas_Object *obj,
+ void *event_info);
+void erss_mouse_out_cursor_change (void *data, Evas *e, Evas_Object *obj,
+ void *event_info);
void erss_list_config_files (int output);
void erss_display_default_usage ();
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- parse.c 23 Jan 2004 00:22:57 -0000 1.21
+++ parse.c 24 Jan 2004 18:04:57 -0000 1.22
@@ -1,17 +1,18 @@
#include "erss.h"
#include "parse.h"
#include "parse_config.h"
+#include "tooltip.h"
Ewd_List *list = NULL;
-Article *item = NULL;
+Erss_Article *item = NULL;
void erss_story_new ()
{
- item = malloc (sizeof (Article));
+ item = malloc (sizeof (Erss_Article));
item->description = NULL;
item->url = NULL;
- memset(item, 0, sizeof (Article));
+ memset(item, 0, sizeof (Erss_Article));
}
void erss_story_end ()
@@ -21,6 +22,7 @@
void erss_parse_story (xmlDocPtr doc, xmlNodePtr cur)
{
+ Erss_Tooltip *tt = NULL;
char *text;
xmlChar *str;
int i;
@@ -51,10 +53,10 @@
evas_object_show (item->obj);
evas_object_event_callback_add (item->obj,
- EVAS_CALLBACK_MOUSE_IN, cb_mouse_in, item);
+ EVAS_CALLBACK_MOUSE_IN,
erss_mouse_in_cursor_change, NULL);
evas_object_event_callback_add (item->obj,
- EVAS_CALLBACK_MOUSE_OUT, cb_mouse_out, item);
-
+ EVAS_CALLBACK_MOUSE_OUT,
erss_mouse_out_cursor_change, NULL);
+
e_container_element_append(cont, item->obj);
edje_object_part_text_set (item->obj, "article", text);
@@ -68,7 +70,7 @@
item->url = strdup (str);
edje_object_signal_callback_add (item->obj, "exec*",
"*",
- cb_mouse_out_item, item);
+ erss_mouse_click_item, item);
edje_object_signal_emit (item->obj, "mouse,in",
"article");
edje_object_signal_emit (item->obj, "mouse,out",
"article");
@@ -80,7 +82,15 @@
if (!strcmp(cur->name, cfg->item_description) && item) {
str = xmlNodeListGetString(doc, cur->xmlChildrenNode,
1);
- item->description = strdup (str);
+ tt = erss_tooltip_new (str);
+
+ if (item->obj) {
+ evas_object_event_callback_add (item->obj,
+ EVAS_CALLBACK_MOUSE_IN,
erss_tooltip_mouse_in, tt);
+ evas_object_event_callback_add (item->obj,
+ EVAS_CALLBACK_MOUSE_OUT,
erss_tooltip_mouse_out, tt);
+ }
+
xmlFree (str);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- parse.h 15 Jan 2004 14:46:46 -0000 1.7
+++ parse.h 24 Jan 2004 18:05:20 -0000 1.8
@@ -1,11 +1,14 @@
-typedef struct _article {
+
+typedef struct _erss_article Erss_Article;
+
+struct _erss_article {
Evas_Object *obj;
char *url;
char *description;
-} Article;
+};
-extern Article *item;
+extern Erss_Article *item;
void erss_story_new ();
void erss_story_end ();
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse_config.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- parse_config.c 15 Jan 2004 14:46:46 -0000 1.1
+++ parse_config.c 24 Jan 2004 18:05:20 -0000 1.2
@@ -2,8 +2,8 @@
#include "parse.h"
#include "parse_config.h"
-Config *cfg = NULL;
-Rc_Config *rc = NULL;
+Erss_Config *cfg = NULL;
+Erss_Rc_Config *rc = NULL;
int erss_parse_rc_file ()
@@ -15,8 +15,8 @@
snprintf (file, PATH_MAX, "%s/.erssrc", getenv ("HOME"));
- rc = malloc (sizeof (Rc_Config));
- memset(rc, 0, sizeof(Rc_Config));
+ rc = malloc (sizeof (Erss_Rc_Config));
+ memset(rc, 0, sizeof (Erss_Rc_Config));
if (!rc)
return FALSE;
@@ -48,6 +48,10 @@
str = xmlNodeListGetString(doc, cur->xmlChildrenNode,
1);
if (str)
rc->proxy_port = atoi (str);
+ } else if (!strcmp(cur->name, "tooltip_delay")) {
+ str = xmlNodeListGetString(doc, cur->xmlChildrenNode,
1);
+ if (str)
+ rc->tooltip_delay = atof (str);
}
if (str) {
@@ -72,6 +76,9 @@
if (!rc->browser)
rc->browser = strdup("mozilla");
+ if (!rc->tooltip_delay)
+ rc->tooltip_delay = 1.5;
+
/*
* If there is no rc file return false for us to know
*/
@@ -133,8 +140,8 @@
/*
* Now allocate and fill the config struct
*/
- cfg = malloc (sizeof (Config));
- memset(cfg, 0, sizeof (Config));
+ cfg = malloc (sizeof (Erss_Config));
+ memset(cfg, 0, sizeof (Erss_Config));
if (!cfg) {
fprintf (stderr, "%s error: out of memory\n", PACKAGE);
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse_config.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- parse_config.h 15 Jan 2004 14:46:46 -0000 1.1
+++ parse_config.h 24 Jan 2004 18:05:20 -0000 1.2
@@ -1,4 +1,7 @@
-typedef struct _config {
+typedef struct _erss_config Erss_Config;
+typedef struct _erss_rc_config Erss_Rc_Config;
+
+struct _erss_config {
char *header;
char *hostname;
char *url;
@@ -22,20 +25,19 @@
char *theme;
char *config;
-} Config;
+};
-typedef struct _rc_config {
+struct _erss_rc_config {
char *config;
char *theme;
char *browser;
char *proxy;
int proxy_port;
- char *enc_from;
- char *enc_to;
-} Rc_Config;
+ double tooltip_delay;
+};
-extern Config *cfg;
-extern Rc_Config *rc;
+extern Erss_Config *cfg;
+extern Erss_Rc_Config *rc;
int erss_parse_rc_file ();
void erss_parse_config_file (char *file);
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs