Hi, I am atm trying to help a little for the first time, working on the
TODO list of Rage. I have started on two items already. One is simple
mouse control for rage, and the other is work on the settings menu. I
would like to hear what you think. I would also like to add support for
an eet configfile to rage, if that's okay with the maintainer. Both
patches apply cleanly to revision 37377, they're not interrelated.
Regards, Tim
# This patch enables mouse events on the menu items
# It shows the mouse pointer temporarily when moved in 
# fullscreen mode
# Leftclick enters an item, rightclick leaves it
--- a/src/bin/menu.c
+++ b/src/bin/menu.c
@@ -73,6 +73,24 @@ _menu_current_get(void)
    return NULL;
 }
 
+void
+_menu_mouseover_select(void *data, Evas_Object *obj, const char *emission, const char *source) 
+{
+   menu_item_select((char*) data);
+}
+
+void
+_menu_mouseover_go(void *data, Evas_Object *obj, const char *emission, const char *source) 
+{
+   menu_item_select_go();
+}
+
+void
+_menu_mouseover_pop(void *data, Evas_Object *obj, const char *emission, const char *source) 
+{
+   if ((menus) && (menus->next)) menu_pop();
+}
+
 static void
 _menu_item_select_update(Menu *m, Menu_Item *mi)
 {
@@ -131,6 +149,9 @@ _menu_realize(Menu *m)
 	mi = l->data;
 	mi->base = edje_object_add(evas);
 	edje_object_file_set(mi->base, theme, "menu_item");
+	edje_object_signal_callback_add(mi->base, "mouse,move", "*", _menu_mouseover_select, (void*)mi->label);
+	edje_object_signal_callback_add(mi->base, "mouse,clicked,1", "*", _menu_mouseover_go, NULL);
+	edje_object_signal_callback_add(mi->base, "mouse,clicked,3", "*", _menu_mouseover_pop, NULL);
 	if (mi->label)
 	  edje_object_part_text_set(mi->base, "label", mi->label);
 	else
--- a/data/default.edc
+++ b/data/default.edc
@@ -1145,6 +1145,21 @@ collections {
 	    }
 	 }
 	 part {
+	    name: "mouse_rectangle";
+	    mouse_events: 1;
+	    type: RECT;
+	    description {
+	       state: "default" 0.0;
+	       color: 0 0 0 0;
+	       rel1 {
+		  offset:  -9 -9;
+	       }
+	       rel2 {
+		  offset:  10 10;
+	       }
+	    }
+	 }
+	 part {
 	    name: "label";
 	    type: TEXT;
             effect: SOFT_OUTLINE;
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -10,6 +10,7 @@ struct _Mode
 Evas        *evas = NULL;
 char        *theme = NULL;
 char        *config = NULL;
+Ecore_Timer* mouse_timeout = NULL;
 
 static double       start_time = 0.0;
 static Ecore_Evas  *ecore_evas = NULL;
@@ -23,6 +24,7 @@ static void main_usage(void);
 static int main_volume_add(void *data, int type, void *ev);
 static int main_volume_del(void *data, int type, void *ev);
 static void main_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void main_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static int  main_signal_exit(void *data, int ev_type, void *ev);
 static void main_delete_request(Ecore_Evas *ee);
 static void main_resize(Ecore_Evas *ee);
@@ -161,6 +163,7 @@ main(int argc, char **argv)
    evas_object_resize(o, startw, starth);
    evas_object_show(o);
    evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, main_key_down, NULL);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, main_mouse_move, NULL);
    evas_object_focus_set(o, 1);
    o_bg = o;
 
@@ -754,3 +757,24 @@ main_menu_tv(void *data)
 {
    system("tvtime -m -n PAL -f custom");
 }
+
+int
+main_mouse_timeout(void* data)
+{
+   ecore_evas_cursor_set(ecore_evas, "", 999, 0, 0);
+   mouse_timeout = NULL;
+   return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+main_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   if (mouse_timeout)
+      ecore_timer_delay(mouse_timeout, 1-ecore_timer_pending_get(mouse_timeout));
+   else
+   {
+      mouse_timeout = ecore_timer_add(1, main_mouse_timeout, NULL);
+      ecore_evas_cursor_set(ecore_evas, NULL, 0, 0, 0);
+   }
+}
+
# This patch adds some config options
# With it, one can toggle fullscreen,
# and change between x11 and xrender (for now)
# It adds a function to restart rage
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -35,7 +35,9 @@ e_table.h \
 e_layout.c \
 e_layout.h \
 e_flowlayout.c \
-e_flowlayout.h
+e_flowlayout.h \
+conf_options.c \
+conf_options.h
 
 rage_LDADD = @my_libs@ @EVAS_LIBS@ @ECORE_LIBS@ @EDJE_LIBS@ @EMOTION_LIBS@
 
--- /dev/null
+++ b/src/bin/conf_options.c
@@ -0,0 +1,57 @@
+#include "conf_options.h"
+#include "main.h"
+
+void 
+config_option_fullscreen(void *data)
+{
+   Ecore_Evas *ee = (Ecore_Evas *)data;
+
+   if (ecore_evas_fullscreen_get(ee))
+   {
+      ecore_evas_fullscreen_set(ee, 0);
+      ecore_evas_cursor_set(ee, NULL, 0, 0, 0);
+   }
+   else 
+   {
+      ecore_evas_fullscreen_set(ee, 1);
+      ecore_evas_cursor_set(ee, "", 999, 0, 0);
+   }
+}
+
+void 
+config_option_themes(void *data)
+{
+}
+
+void
+config_option_modes_switch(void* data)
+{
+   char* engine = (char*)data;
+   if (!strcmp(engine, "software_x11"))
+      main_reset("-x11");
+   else if (!strcmp(engine, "xrender_x11"))
+      main_reset("-xr");
+}
+
+void 
+config_option_modes(void *data)
+{
+   Eina_List *el, *l;
+
+   el = ecore_evas_engines_get();
+   
+   menu_push("menu", "Modes", NULL, NULL);
+   for (l = el; l; l=l->next)
+   {
+   	menu_item_add("icon/modes", l->data,
+		      NULL, NULL, config_option_modes_switch,  
+		      l->data, NULL, NULL, NULL);
+   }
+
+   menu_go();
+   menu_item_select(el->data);
+
+   ecore_evas_engines_free(el);
+}
+
+void 
+config_option_volumes(void *data)
+{
+}
+

--- /dev/null
+++ b/src/bin/conf_options.h
@@ -0,0 +1,10 @@
+#ifndef conf_options_h
+#define conf_options_h
+
+void config_option_fullscreen(void *data);
+void config_option_themes(void *data);
+void config_option_modes(void *data);
+void config_option_volumes(void *data);
+
+#endif
+
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -342,24 +342,24 @@ static void
 main_menu_config(void *data)
 {
    menu_push("menu", "Settings", NULL, NULL);
-   menu_item_add("icon/config", "Option 1",
-		  "Option 1", NULL,
-		  NULL, NULL, NULL, NULL, NULL);
-   menu_item_add("icon/config", "Option 2",
-		  "Option 2", NULL,
-		  NULL, NULL, NULL, NULL, NULL);
-   menu_item_add("icon/config", "Option 3",
-		  "Option 3", NULL,
-		  NULL, NULL, NULL, NULL, NULL);
-   menu_item_add("icon/config", "Option 4",
-		  "Option 4", NULL,
-		  NULL, NULL, NULL, NULL, NULL);
-   menu_item_enabled_set("Settings", "Option 1", 1);
-   menu_item_enabled_set("Settings", "Option 2", 1);
-   menu_item_enabled_set("Settings", "Option 3", 1);
-   menu_item_enabled_set("Settings", "Option 4", 1);
+   menu_item_add("icon/fullscreen", "Fullscreen",
+		  "Fullscreen On/Off", NULL,
+		  config_option_fullscreen, ecore_evas, NULL, NULL, NULL);
+   menu_item_add("icon/themes", "Themes",
+		  "Select your theme", NULL,
+		  config_option_themes, NULL, NULL, NULL, NULL);
+   menu_item_add("icon/modes", "Modes",
+		  "Change the engine Rage uses", NULL,
+		  config_option_modes, ecore_evas, NULL, NULL, NULL);
+   menu_item_add("icon/volumes", "Volumes",
+		  "Edit your Volumes", NULL,
+		  config_option_volumes, NULL, NULL, NULL, NULL);
+   menu_item_enabled_set("Settings", "Fullscreen", 1);
+   menu_item_enabled_set("Settings", "Themes", 1);
+   menu_item_enabled_set("Settings", "Modes", 1);
+   menu_item_enabled_set("Settings", "Volumes", 1);
    menu_go();
-   menu_item_select("Option 1");
+   menu_item_select("Fullscreen");
 }
 
 typedef struct _Genre          Genre;
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -9,6 +9,7 @@
 #include "mini.h"
 #include "minivid.h"
 #include "sha1.h"
+#include "conf_options.h"
 
 extern Evas *evas;
 extern char *theme;
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -271,6 +271,12 @@ main_usage(void)
    exit(-1);
 }
 
+void
+main_reset(char *arg)
+{
+   execlp("rage", "rage", arg, NULL);
+}
+
 static int
 main_volume_add(void *data, int type, void *ev)
 {
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -20,3 +20,4 @@ extern char *config;
 
 void main_mode_push(int mode);
 void main_mode_pop(void);
+void main_reset(char* arg);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to