Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        config.c 


Log Message:
Fix menu location so it is never offscreen
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/config.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- config.c    9 May 2004 15:18:09 -0000       1.16
+++ config.c    10 May 2004 10:17:52 -0000      1.17
@@ -109,6 +109,7 @@
 }
 
 #ifdef HAVE_EWL
+int        menu_height, menu_width;
 
 void
 od_config_menu_move_cb(Ewl_Widget * w, void *ev_data, void *user_data)
@@ -145,6 +146,9 @@
   if (init)
     return;
   init = 1;
+  /* FIXME: nasty nasty, we need to request the size, not code it in */
+  menu_height = 50;
+  menu_width = 100;
 
   menu_win = ewl_embed_new();
   ewl_object_set_fill_policy((Ewl_Object *) menu_win, EWL_FLAG_FILL_FILL);
@@ -155,7 +159,7 @@
   evas_object_layer_set(embed, 999);
 
   /* FIXME: this should not be needed */
-  evas_object_resize(embed, 100, 50);
+  evas_object_resize(embed, menu_width, menu_height);
   evas_object_show(embed);
   ewl_widget_show(menu_win);
 
@@ -198,8 +202,25 @@
 void
 od_config_menu_draw(Evas_Coord x, Evas_Coord y)
 {
+  int xx, yy, menu_off_x, menu_off_y;
+  menu_off_x = 5; menu_off_y = 5;
+  
   od_config_menu_init();
-  evas_object_move(embed, x - 5, y - 5);
+  if (x - menu_off_x + menu_width > options.width)
+    xx = options.width - menu_width;
+  else
+    if (x < menu_off_x)
+      xx = 0;
+    else
+      xx = x - menu_off_x;
+  if (y - menu_off_y + menu_height > options.height)
+    yy = options.height - menu_height;
+  else
+    if (y < menu_off_y)
+      yy = 0;
+    else
+      yy = y - menu_off_y;
+  evas_object_move(embed, xx, yy);
   ewl_callback_call(menu, EWL_CALLBACK_SELECT);
 }
 




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to