Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_datepicker.c ewl_embed.c ewl_embed.h ewl_events.c 
        ewl_menu.c ewl_window.c ewl_window.h 


Log Message:
Patch from Peter Wehrfritz to move position coordinate tracking to the embed 
from the window.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_datepicker.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_datepicker.c    17 Feb 2006 06:43:33 -0000      1.10
+++ ewl_datepicker.c    12 Apr 2006 06:41:55 -0000      1.11
@@ -1,7 +1,7 @@
+#include "ewl_private.h"
 #include <Ewl.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
-#include "ewl_private.h"
 
 static void ewl_datepicker_calendar_position_set(Ewl_Datepicker *dp);
 static void ewl_datepicker_dropdown_cb(Ewl_Widget *w, void *ev_data, 
@@ -157,7 +157,7 @@
        /* Get the position of the parent */
        emb = ewl_embed_widget_find(EWL_WIDGET(dp));
        if (emb) {
-               ewl_window_position_get(EWL_WINDOW(emb), &x, &y);
+               ewl_embed_window_position_get(EWL_EMBED(emb), &x, &y);
                ewl_object_current_size_get(EWL_OBJECT(dp), &sx, &sy);
                ewl_window_move(EWL_WINDOW(dp->calendar_window), x + (sx / 4), 
                                                                y + sy + 3);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- ewl_embed.c 31 Mar 2006 06:31:42 -0000      1.54
+++ ewl_embed.c 12 Apr 2006 06:41:55 -0000      1.55
@@ -1,7 +1,7 @@
+#include "ewl_private.h"
 #include <Ewl.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
-#include "ewl_private.h"
 
 Ecore_List *ewl_embed_list = NULL;
 static Evas_Smart *embedded_smart = NULL;
@@ -1500,6 +1500,53 @@
                                        
ecore_x_cursor_shape_get(EWL_MOUSE_CURSOR_LEFT_PTR));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: the embed to query for position
+ * @param x: a pointer to the integer that should receive the x coordinate
+ * @param y: a pointer to the integer that should receive the y coordinate
+ * @return Returns no value.
+ * @brief Retrieve the position of the embed
+ *
+ * Stores the embed position into the parameters @a x and @a y.
+ */
+void
+ewl_embed_position_get(Ewl_Embed *e, int *x, int *y)
+{
+       int sx, sy;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("e", e);
+       DCHECK_TYPE("e", e, EWL_EMBED_TYPE);
+
+       evas_object_geometry_get(e->smart, &sx, &sy, NULL, NULL);
+       if (x) *x = e->x + sx;
+       if (y) *y = e->y + sy;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: the embed to query for window-position
+ * @param x: a pointer to the integer that should receive the x coordinate
+ * @param y: a pointer to the integer that should receive the y coordinate
+ * @return Returns no value.
+ * @brief Retrieve the position of the window
+ *
+ * Stores the window position into the parameters @a x and @a y.
+ */
+void
+ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("e", e);
+       DCHECK_TYPE("e", e, EWL_EMBED_TYPE);
+
+       if (x) *x = e->x;
+       if (y) *y = e->y;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_embed.h 15 Mar 2006 04:03:48 -0000      1.16
+++ ewl_embed.h 12 Apr 2006 06:41:55 -0000      1.17
@@ -70,6 +70,9 @@
                Ewl_Widget *mouse_in; /**< Last widget to receive a mouse_in */
        } last;                      /**< Collection of widgets to last receive 
events */
 
+        int             x; /**< Screen relative horizontal position of window 
*/
+        int             y; /**< Screen relative vertical position of window */
+
        Ewl_Widget *dnd_widget;      /**< The current DND widget */
 };
 
@@ -132,6 +135,8 @@
                                          int *x, int *y);
 
 void           ewl_embed_mouse_cursor_set(Ewl_Widget *w);
+void            ewl_embed_position_get(Ewl_Embed *e, int *x, int *y);
+void            ewl_embed_window_position_get(Ewl_Embed *e, int *x, int *y);
 
 /*
  * Internally used callbacks, override at your own risk.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_events.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ewl_events.c        28 Mar 2006 12:25:38 -0000      1.25
+++ ewl_events.c        12 Apr 2006 06:41:55 -0000      1.26
@@ -1,7 +1,7 @@
+#include "ewl_private.h"
 #include <Ewl.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
-#include "ewl_private.h"
 
 extern Ecore_List *ewl_embed_list;
 static unsigned int key_modifiers = 0;
@@ -217,26 +217,34 @@
         */
        Ecore_X_Event_Window_Configure *ev;
        Ewl_Window *window;
+       Ewl_Embed *embed;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        ev = e;
 
-       window = ewl_window_window_find((void *)ev->win);
-       if (!window)
+       embed = ewl_embed_evas_window_find((void *)ev->win);
+       if (!embed)
                DRETURN_INT(TRUE, DLEVEL_STABLE);
 
        /*
         * Save coords and queue a configure event if the window is moved.
         */
-       if ((ev->from_wm) && (ev->x != window->x)) {
-               window->x = ev->x;
+       if ((ev->from_wm) && (ev->x != embed->x)) {
+               embed->x = ev->x;
        }
 
-       if ((ev->from_wm) && (ev->y != window->y)) {
-               window->y = ev->y;
+       if ((ev->from_wm) && (ev->y != embed->y)) {
+               embed->y = ev->y;
        }
 
+       window = ewl_window_window_find((void *)ev->win);
+       /*
+        * we can finish when the embed is not a window
+        */
+       if (!window)
+               DRETURN_INT(TRUE, DLEVEL_STABLE);
+
        ewl_widget_configure(EWL_WIDGET(window));
 
        /*
@@ -627,7 +635,7 @@
        if (window) {
                Ewl_Embed *embed;
                
-               ewl_window_position_get(EWL_WINDOW(window), &wx, &wy);
+               ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
                x = ev->position.x - wx;
                y = ev->position.y - wy;
 
@@ -757,7 +765,7 @@
        if (window) {
                int x,y,wx,wy;
                Ewl_Embed *embed= ewl_embed_evas_window_find((void *)ev->win);
-               ewl_window_position_get(EWL_WINDOW(window), &wx, &wy);
+               ewl_embed_window_position_get(EWL_EMBED(window), &wx, &wy);
 
                printf("Wx/y: %d:%d\n", wx,wy);
                
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_menu.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_menu.c  17 Feb 2006 06:43:33 -0000      1.26
+++ ewl_menu.c  12 Apr 2006 06:41:55 -0000      1.27
@@ -1,7 +1,7 @@
+#include "ewl_private.h"
 #include <Ewl.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
-#include "ewl_private.h"
 
 
 /**
@@ -125,7 +125,7 @@
        menu = EWL_MENU(w);
        emb = ewl_embed_widget_find(w);
 
-       ewl_window_position_get(EWL_WINDOW(emb), &x, &y);
+       ewl_embed_window_position_get(EWL_WINDOW(emb), &x, &y);
        menu->popup_x = x + CURRENT_X(w);
        menu->popup_y = y + CURRENT_Y(w);
 
@@ -241,8 +241,8 @@
        
        embed = ewl_embed_widget_find(EWL_WIDGET(menu)->parent);
        menu_embed = ewl_embed_widget_find(EWL_WIDGET(menu->base.popup));
-       ewl_window_position_get(EWL_WINDOW(embed), &wx, &wy);
-       ewl_window_position_get(EWL_WINDOW(menu->base.popup), &x, &y);
+       ewl_embed_window_position_get(EWL_WINDOW(embed), &wx, &wy);
+       ewl_embed_window_position_get(EWL_WINDOW(menu->base.popup), &x, &y);
        ewl_object_current_size_get(EWL_OBJECT(menu->base.popup), &width, 
&height);
 
        if (((ev->x + x) > x) && ((ev->y + y) > y) 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_window.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_window.c        29 Mar 2006 14:36:48 -0000      1.39
+++ ewl_window.c        12 Apr 2006 06:41:55 -0000      1.40
@@ -1,7 +1,7 @@
+#include "ewl_private.h"
 #include <Ewl.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
-#include "ewl_private.h"
 
 Ecore_List *ewl_window_list = NULL;
 
@@ -300,8 +300,8 @@
        DCHECK_PARAM_PTR("win", win);
        DCHECK_TYPE("win", win, EWL_WINDOW_TYPE);
 
-       win->x = x;
-       win->y = y;
+       EWL_EMBED(win)->x = x;
+       EWL_EMBED(win)->y = y;
 
        if (!REALIZED(win))
                DRETURN(DLEVEL_STABLE);
@@ -314,28 +314,6 @@
 }
 
 /**
- * @param win: the window to query for position
- * @param x: a pointer to the integer that should receive the x coordinate
- * @param y: a pointer to the integer that should receive the y coordinate
- * @return Returns no value.
- * @brief Retrieve the position of the window
- *
- * Stores the window position into the parameters @a x and @a y.
- */
-void
-ewl_window_position_get(Ewl_Window *win, int *x, int *y)
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("win", win);
-       DCHECK_TYPE("win", win, EWL_WINDOW_TYPE);
-
-       if (x) *x = win->x;
-       if (y) *y = win->y;
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
  * @param win: the window to raise.
  * @return Returns no value.
  * @brief Raise a window.
@@ -690,14 +668,14 @@
                Ecore_X_Window xwin;
 
                if (window->flags & EWL_WINDOW_OVERRIDE) {
-                       xwin = ecore_x_window_override_new(0, window->x,
-                                                 window->y,
+                       xwin = ecore_x_window_override_new(0, embed->x,
+                                                 embed->y,
                                                  ewl_object_current_w_get(o),
                                                  ewl_object_current_h_get(o));
                }
                else {
-                       xwin = ecore_x_window_new(0, window->x,
-                                                 window->y,
+                       xwin = ecore_x_window_new(0, embed->x,
+                                                 embed->y,
                                                  ewl_object_current_w_get(o),
                                                  ewl_object_current_h_get(o));
                }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_window.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_window.h        15 Mar 2006 04:03:48 -0000      1.14
+++ ewl_window.h        12 Apr 2006 06:41:55 -0000      1.15
@@ -50,8 +50,6 @@
         
        Ewl_Window_Flags flags; /**< Flags indicating window properties */
 
-       int             x; /**< Screen relative horizontal position of window */
-       int             y; /**< Screen relative vertical position of window */
        char           *render; /**< The render engine in use */
 
        Ewl_Dnd_Types dnd_types;        /**< The dnd type */
@@ -69,7 +67,6 @@
 char           *ewl_window_class_get(Ewl_Window *win);
 void            ewl_window_borderless_set(Ewl_Window *win);
 void            ewl_window_move(Ewl_Window *win, int x, int y);
-void            ewl_window_position_get(Ewl_Window *win, int *x, int *y);
 void            ewl_window_raise(Ewl_Window *win);
 void            ewl_window_lower(Ewl_Window *win);
 void            ewl_window_transient_for(Ewl_Window *win, Ewl_Window * forwin);




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to