Nathan Ingersoll schrieb:
Thanks for the information Peter. That line would definitely cause
that warning to be printed. Looks like we need to register an ecore_x
callback for the configure event on the embed and store the window
position information.
Here is a patch to solve the problem. It moves ewl_window_postion_get()
to ewl_embed_window_position_get() and adds ewl_embed_position_get(). I
don't know if the last one is really needed, so you can also remove it.
Actually the menu doesn't need it.
ciao
peter
? .cvsignore
Index: ewl_datepicker.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_datepicker.c,v
retrieving revision 1.10
diff -u -r1.10 ewl_datepicker.c
--- ewl_datepicker.c 17 Feb 2006 06:43:33 -0000 1.10
+++ ewl_datepicker.c 6 Apr 2006 20:09:06 -0000
@@ -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(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);
Index: ewl_embed.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.54
diff -u -r1.54 ewl_embed.c
--- ewl_embed.c 31 Mar 2006 06:31:42 -0000 1.54
+++ ewl_embed.c 6 Apr 2006 20:09:20 -0000
@@ -1502,6 +1502,53 @@
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
ewl_embed_realize_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
void *user_data __UNUSED__)
Index: ewl_embed.h
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_embed.h,v
retrieving revision 1.16
diff -u -r1.16 ewl_embed.h
--- ewl_embed.h 15 Mar 2006 04:03:48 -0000 1.16
+++ ewl_embed.h 6 Apr 2006 20:09:21 -0000
@@ -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.
Index: ewl_events.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_events.c,v
retrieving revision 1.25
diff -u -r1.25 ewl_events.c
--- ewl_events.c 28 Mar 2006 12:25:38 -0000 1.25
+++ ewl_events.c 6 Apr 2006 20:09:25 -0000
@@ -217,26 +217,33 @@
*/
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 +634,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 +764,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);
Index: ewl_menu.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_menu.c,v
retrieving revision 1.26
diff -u -r1.26 ewl_menu.c
--- ewl_menu.c 17 Feb 2006 06:43:33 -0000 1.26
+++ ewl_menu.c 6 Apr 2006 20:09:26 -0000
@@ -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_EMBED(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_EMBED(embed), &wx, &wy);
+ ewl_embed_window_position_get(EWL_EMBED(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)
Index: ewl_window.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_window.c,v
retrieving revision 1.39
diff -u -r1.39 ewl_window.c
--- ewl_window.c 29 Mar 2006 14:36:48 -0000 1.39
+++ ewl_window.c 6 Apr 2006 20:09:31 -0000
@@ -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));
}
Index: ewl_window.h
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_window.h,v
retrieving revision 1.14
diff -u -r1.14 ewl_window.h
--- ewl_window.h 15 Mar 2006 04:03:48 -0000 1.14
+++ ewl_window.h 6 Apr 2006 20:09:31 -0000
@@ -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);